Compression method for concentration data of gas detector
Through dynamic feature classification and data compression method of adaptive window adjustment of greedy algorithms, the problem of ignoring fluctuation characteristics in gas detector data compression is solved, and efficient data compression and fast early warning are achieved.
Patent Information
- Application Number
- CN202510535712.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-08
AI Technical Summary
Existing gas detectors ignore data fluctuations during data compression, which easily loses key waveforms of leakage events, resulting in an imbalance between compression rate and information fidelity, and unable to effectively conduct early warnings.
Dynamic feature classification, adaptive window adjustment of greedy algorithms and segmented splicing strategies are adopted to dynamic feature classification of gas detector concentration data, data compression is carried out separately according to different state characteristics, and cross-frame data splicing is performed through greedy algorithms.
It achieves the maximum data compression efficiency per unit time, reduces the total data transmission amount, reduces the pressure of data transmission bandwidth, and retains key information through curved data fitting, supporting rapid early warning and equipment maintenance.
Smart Images

Figure CN120454734A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data compression in signal processing, and in particular to a method for compressing concentration data of a gas detector. Background Art
[0002] Gas detectors generate massive amounts of intermediate data during detection. Limited by the detector's hardware resources (memory and computing power), they are unable to perform correlation calculations and periodic regularity determinations on environmental variables. Traditional methods only collect data during the gas detector's fixed heartbeat period and when the alarm is triggered. This results in the loss of routine monitoring data from the detector, making it impossible to analyze historical trends for early warning and protect life and property. Existing compression technologies (such as fixed window averaging) reduce storage capacity but ignore data fluctuation characteristics, making it easy to lose key waveforms of leakage events. Furthermore, the single splicing logic leads to an imbalance between compression rate and information fidelity.
[0003] The invention patent with application number 202311862426.3 discloses a gas concentration detection method, which includes: obtaining the original detection data of the pyroelectric non-spectroscopy infrared gas detector when the gas to be measured is passed; wherein the original detection data is the electrical signal output by the pyroelectric non-spectroscopy infrared gas detector; performing windowing processing on the original detection data to obtain pre-processed data; using a preset Goetzel algorithm to extract the pre-processed data to obtain valid detection data; performing concentration calculation based on the valid detection data, a preset calibration zero point value and a preset target gas concentration calculation model to obtain the concentration value of the gas to be measured. The above invention can reduce the amount of calculation required for concentration calculation and improve the accuracy of gas concentration calculation. However, the above invention is mainly used for concentration calculation of sensors, and does not compress the concentration data, which is inconvenient for data storage and transmission. Summary of the Invention
[0004] In response to the technical problems of existing data compression methods such as ignoring data fluctuation characteristics and easily losing key waveforms of leakage events, the present invention proposes a compression method for gas detector concentration data. Through dynamic feature classification, greedy algorithm adaptive window adjustment, and segmented splicing strategy modeling, it solves the data storage and transmission problems of resource-constrained devices, reduces the total amount of data transmitted, and alleviates the pressure on data transmission bandwidth.
[0005] In order to achieve the above object, the technical solution of the present invention is implemented as follows: a method for compressing gas detector concentration data, the steps of which are as follows:
[0006] Step 1: Dynamically classify the concentration data collected by the gas detector to obtain data segments with different state characteristics, and perform data compression according to different state characteristics;
[0007] Step 2: Protocol encapsulation: perform protocol encapsulation based on the concentration data compressed in step 1;
[0008] Step 3: After completing the data compression within the storage period, a greedy algorithm is used to splice the features of adjacent frames to achieve cross-frame data splicing.
[0009] Preferably, the method of performing data compression according to different state characteristics in step 1 is:
[0010] a. If the gas concentration mean M of the concentration data within a storage cycle is less than the threshold Thre1, the gas detector is in normal detection state, recorded as feature I, and the gas concentration mean M and the number of concentration values n are recorded;
[0011] b. If the mean gas concentration M of the concentration data within a storage cycle is greater than the threshold Thre1 and the standard deviation σ is less than the threshold Thre2, the gas detector is detecting normally but has a certain amount of drift, indicating a drift state. This is recorded as Feature II, and the mean gas concentration M and the number of gas samples are recorded.
[0012] c. If the mean gas concentration M of the concentration data within a storage cycle is greater than the threshold Thre1, and the standard deviation σ of the concentration data is greater than the threshold Thre2, perform inflection point analysis on the collected data segment. If the number of inflection points is less than the threshold Thre3, it indicates that there are large fluctuations within the data segment, indicating an abnormal fluctuation state. Data compression is performed using a complex data compression method, and the recorded state is recorded as Feature III.
[0013] d. If the mean gas concentration M of the concentration data within a storage cycle is greater than the threshold Thre1, the standard deviation σ of the concentration data is greater than the threshold Thre2, and the number of inflection points in the data segment is greater than the threshold Thre3, the data is in a chaotic state and recorded as feature IV. The data in the data segment is retained.
[0014] Preferably, the mean gas concentration is: Where M is the average gas concentration of the environment where the gas detector is located, A(i) is the gas concentration value of the i-th sampling, and n is the number of times the environmental concentration is collected during the storage period;
[0015] The calculation formula of the standard deviation σ is:
[0016] The threshold Thre1 is smaller than the measurement error of the device, and the number is the number of gas concentration values in the time period;
[0017] The threshold Thre2 is determined by the dispersion coefficient, where the dispersion coefficient Cv=σ / M.
[0018] Preferably, the inflection point analysis is to roughly fit the waveform of the data, and the waveform of the abnormal fluctuation state is bell-shaped or half-bell-shaped. The larger or smaller value in the concentration data is found through the inflection point analysis;
[0019] The method for judging the inflection point is: calculate the intermediate value G(i) = (A(i) - A(i - 1)) * (A(i + 1) - A(i)). If the intermediate value G(i) < 0, then the position i is the inflection point; A(i - 1), A(i), and A(i + 1) respectively represent the gas concentration values of the (i - 1)-th, i-th, and (i + 1)-th samplings;
[0020] The threshold Thre3 is determined according to the length of the storage period and the characteristics of the sensor.
[0021] Preferably, the method for data compression by the complex data compression method is: traverse the concentration data within a storage period, determine the number of inflection points and the position i, and perform segmented modeling:
[0022] If the gas concentration value A(i + 1) of the (i + 1)-th sampling is equal to A(i), it is a constant segment, and the average value M of the gas concentration, the quantity, and the characteristic information of the data position are recorded. If the average value M of the gas concentration is less than the threshold Thre1, it is characteristic I; if the average value M of the gas concentration is greater than or equal to the threshold Thre1, it is characteristic II; if the gas concentration value A(i + 1) of the (i + 1)-th sampling is less than A(i) or A(i + 1) > A(i), the concentration data is a monotonically increasing or decreasing segment, and the initial value, slope, deviation value, quantity, and characteristic information of the data position of the concentration data are updated and recorded; until the traversal ends;
[0023] The linear model of the monotonically increasing or decreasing segment is A(i) = K * A(i - 1) + b, where K is the slope and b is the deviation value. The initial value, slope, deviation value, and data range of the concentration data are recorded using the linear model; the slope and deviation value are obtained according to the least squares method.
[0024] Preferably, protocol encapsulation is performed by referring to the start time of the concentration data, the data compression result, the start characteristic of the data, and the end characteristic of the data.
[0025] Preferably, the method for data splicing includes: 1) If the data characteristic of this frame is characteristic I and the data characteristic of the next frame is characteristic I, directly perform data splicing: retain the number of the data characteristic, update the data quantity, and take the larger value of the average gas concentration;
[0026] 2) If the data characteristic of this frame is characteristic I and the data characteristic of the next frame is characteristic II, if the average gas concentration meets the error requirement, perform data splicing, retain the number of the data characteristic, and update the data quantity; if the average gas concentration is inconsistent, compress and splice the data separately;
[0027] 3) If the data feature of the current frame is feature I and the data feature of the next frame is feature III, if the data feature at the beginning of the next frame is type I, then directly perform data splicing according to 1); if the data feature at the beginning of the next frame is II, and the gas concentration mean and the current frame meet the error requirements, then perform data splicing according to 2); in other cases, compress the data separately and splice them.
[0028] Preferably, the data splicing method includes:
[0029] 4) If the data feature of the current frame is Feature II and the data feature of the next frame is Feature I, and if the mean gas concentration meets the error requirement, perform data splicing according to 1); in other cases, perform data compression and splicing separately;
[0030] 5) If the data feature of the current frame is Feature II and the data feature of the next frame is Feature II, and if the gas concentration mean values are consistent, then data splicing is performed: the data feature number is retained and the data quantity is updated; if the volume concentration mean values are inconsistent, then the data are compressed and spliced separately;
[0031] 6) If the data feature of the current frame is feature II and the data feature of the next frame is feature III, if the starting feature of the next frame data is I and the gas concentration mean meets the error requirements of the current frame, then perform data splicing according to 2); if the starting feature of the next frame data is type II and the gas concentration mean is consistent with that of the current frame, then perform data splicing: retain the characteristics of the data numbers and update the data quantity; in other cases, compress the data separately and splice them.
[0032] Preferably, the data splicing method includes:
[0033] 7) If the data feature of the current frame is Feature III, and the data feature of the next frame is Feature I, and if the ending feature of the current frame data is Type I, then perform data splicing according to 1); if the ending feature of the current frame data is Type II, and the gas concentration mean and the data mean of the next frame meet the error requirements, then perform data splicing according to 2); in other cases, perform compressed data splicing separately;
[0034] 8) If the data feature of the current frame is Feature III and the data feature of the next frame is Feature II, if the ending feature of the current frame data is Type I and the gas concentration mean and the gas concentration mean of the next frame data meet the error requirements, then perform data splicing according to 2); if the ending feature of the current frame data is Type II and the gas concentration mean is consistent with the next frame data, then perform data splicing according to 5); in other cases, perform compressed data splicing separately;
[0035] 9) If the data feature of this frame is feature III and the data feature of the next frame is feature III, if the biological ending feature of this frame data is I and the starting feature of the next frame data is I, then data splicing is performed according to 1); if the ending feature of this frame data is type I and the starting feature of the next frame data is II, if the mean gas concentration meets the error requirement, then data splicing is performed according to 2); if the ending feature of this frame data is II and the starting feature of the next frame data is I, if the mean gas concentration meets the error requirement, then data splicing is performed according to 2); if the ending feature of this frame data is II and the starting feature of the next frame data is II, if the mean gas concentration is consistent, then data splicing is performed according to 5); if the ending feature of this frame data is III and the starting feature of the next frame data is III, and the average slope and deviation value of the next frame data are consistent with the current frame data, and the initial data of the next frame data and the initial data of the previous frame data meet the continuity requirements, data splicing can be performed to update the initial value, quantity, and position of the concentration data; in other cases, data splicing is performed separately.
[0036] Preferably, the initial data of the lower frame data and the initial data of the upper frame data meet the continuity requirement: initial data of the lower frame data = initial data of the upper frame data + average slope * number of features III of the upper frame data + deviation value.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] Since the output waveform of the on-site environmental concentration is mainly characterized by Type I and Type II, the concentration waveform characteristics are classified through dynamic feature classification to achieve the maximum data compression efficiency per unit time. At the same time, by marking the characteristics of gas leaks or gas detectors that cannot operate normally, rapid equipment warning or maintenance can be achieved.
[0039] After completing the compression of the detector output waveform within a unit time, the data protocol is encapsulated according to the waveform characteristics, and the segmented splicing strategy is used to model the encapsulated data and perform data segment splicing, which not only maximizes the compression efficiency but also enables rapid analysis of the data field.
[0040] During data compression and data segment splicing, a greedy algorithm is used for adaptive window adjustment to facilitate data processing integrity while ensuring compression efficiency.
[0041] The present invention reduces the total amount of data transmission and alleviates the pressure on data transmission bandwidth through the above-mentioned data compression and splicing scheme. At the same time, through curve data fitting and splicing, it retains the key information in the data. At the same time, through the marking of characteristic values, it realizes the preliminary processing of the collected data by the underlying detector, reducing the burden on the upper-level application. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 Flowchart of the present invention.
[0044] Figure 2 Flowchart of dynamic feature classification of the present invention.
[0045] Figure 3 for Figure 2 Flowchart of the complex data compression method in .
[0046] Figure 4 This is a framework diagram of the data encapsulation format of the present invention.
[0047] Figure 5 This is a data splicing flow chart when the ending feature of the present invention is feature I.
[0048] Figure 6 This is a data splicing flow chart when the ending feature of the present invention is feature II.
[0049] Figure 7 This is a data splicing flow chart when the ending feature of the present invention is feature III. DETAILED DESCRIPTION
[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without creative work are within the scope of protection of the present invention.
[0051] like Figure 1 As shown, an embodiment of the present invention provides a method for compressing gas detector concentration data. The specific steps of the implementation architecture method are: the detector acquires concentration value data of the current environment within a custom storage period (the default below is one minute), performs dynamic feature classification and preliminary compression on the concentration value characteristics of the gas detector, and after compression is completed, encapsulates it according to the data protocol. After encapsulation is completed, a greedy algorithm is used to splice data between compressed data segments.
[0052] Step 1: Perform dynamic feature classification on the concentration data collected by the gas detector to obtain data segments with different state features, and perform data compression according to different state features.
[0053] The gas detector detects that the sensor output concentration data has the following characteristics:
[0054] Feature I: When there is no gas leakage and the sensor is working normally, the concentration output waveform displays a value of 0 in a clean air environment;
[0055] Feature II: When there is no gas leakage, the sensor may experience zero drift due to aging, causing the detector to output a fixed concentration value.
[0056] Feature III. When a gas leak occurs, the one-dimensional waveform of the concentration data exhibits a bell or half-bell shape.
[0057] Feature IV: Changes in temperature, humidity, and other factors in the installation environment can cause deviations in sensor accuracy, resulting in chaotic concentration output from the detector.
[0058] Therefore, the concentration data collected by the gas detector can be classified by dynamic feature classification, and the concentration data within a unit time can be classified and compressed according to different features, which can improve the efficiency of data compression. Figure 2 As shown in the figure, the implementation method of dynamic feature classification is:
[0059] 1.1 Mean Calculation
[0060] Calculate the mean gas concentration value for one minute of concentration output waveform data:
[0061]
[0062] This is the formula for calculating the data average, where M is the average gas concentration in the environment where the gas detector is located, A(i) is the gas concentration value at the i-th sampling time. This data is obtained by the gas detector by periodically acquiring the gas sensor output signal and converting it into real-time concentration. n is the number of times the ambient concentration is collected during the storage cycle. Based on the frequency at which the gas detector reads the sensor concentration value, if the acquisition frequency is once every 1 second, then n = 60 / 1 = 60.
[0063] 1.2 Feature Classification
[0064] a. If the gas concentration mean M is less than the threshold Thre1, it proves that the gas detector is in a normal detection state during this one-minute period, and the recorded state is feature I (normal state), and the gas concentration mean M and the number of concentration values n are recorded.
[0065] The value of Threshold Thre1 is mainly based on the measurement error of the device. If it is less than the measurement error, the current state does not pose a risk and meets the accuracy requirements of the device. The number is generally the number of gas concentration values in a time period. If it is one minute, the number is n(60).
[0066] b. If the mean gas concentration M is greater than the threshold Thre1, and the standard deviation σ of the concentration data is less than the threshold Thre2, it proves that during this time period, the gas detector is in a normal detection state, but there is a certain amount of drift. This may be due to sensor aging, or there is a certain concentration of gas on site, but it is not enough to trigger an alarm. It is necessary to check the on-site environment or re-calibrate the equipment, record the state as Feature II (Drift State), and record the mean gas concentration M and quantity. Among them, the standard deviation of the concentration data is calculated as:
[0067] Threshold Thre2 is typically determined using the coefficient of dispersion formula: Cv = σ / M. Different gases have different discrete systems. For example, for combustible gas, the coefficient of dispersion Cv is set to 5, and then Threshold Thre2 = σ = 5*M. In this case, the mean gas concentration M is greater than Threshold Thre1 but less than the alarm level of the gas detector. Generally, the mean gas concentration M is set to 1 / 2 of the alarm level of the gas detector. The mean gas concentration M is related to Threshold Thre1, and Threshold Thre2 is also related to the mean gas concentration M.
[0068] The present invention compresses and stores data for both the normal state feature I and the offset state feature II by recording only the feature markers and the corresponding gas concentration mean M and count for each data segment. This is done to prepare for data splicing below. For identical M values, if the standard deviation is less than the threshold Thre2, splicing is possible, increasing the compression ratio. For example, if the first segment has a mean M = 2 and a count of 60, belonging to feature II, and the second segment has a mean M = 2 and a count of 120, also belonging to feature II, then after subsequent splicing, the data is combined and recorded as the first segment with a mean M = 2 and a count of 180 (60 + 120), belonging to feature II.
[0069] c. If the mean gas concentration M is greater than the threshold Thre1 and the standard deviation σ of the concentration data is greater than the threshold Thre2, an inflection point analysis is performed on the collected data segment. If the number of inflection points is less than the threshold Thre3, it indicates that there are large fluctuations in the data segment, and there may be a serious gas leak, which requires emergency treatment. Data compression is performed according to the complex data compression method, and the recorded status is Feature III (abnormal fluctuation state).
[0070] Inflection point analysis is to roughly fit the waveform of the data. If a gas leaks, it is usually bell-shaped or half-bell-shaped. Inflection point analysis is to find the larger value (upper peak) or smaller value (lower bottom point) in the concentration data to determine whether the current data is a rising waveform or a complete waveform, or is truncated in the process. The inflection point judgment method is:
[0071] G(i) = (A(i) - A(i - 1)) * (A(i + 1) - A(i)). If G(i) < 0, then the position i is an inflection point. A(i - 1) and A(i + 1) respectively represent the gas concentration values of the (i - 1)-th and (i + 1)-th samplings.
[0072] G(i) is used to determine whether this point is the upper vertex or the lower bottom point of the curve. It is calculated based on the characteristic that the data change rates on the left and right sides of such points are opposite. The range of the threshold Thre3 is determined according to the length of the time period and the sensor characteristics. If it is 1 minute, under normal circumstances, for combustible gases, there are generally less than 2 - 3 inflection points, so the threshold is set to 3.
[0073] Through such judgment, if within this interval, the number of inflection points is greater than the threshold, it means that this section of data is changing irregularly and cannot be effectively compressed. If there are few inflection points, it can be compressed according to the following method.
[0074] As Figure 3 shown, the implementation method of the complex data compression method is as follows: Traverse the data of the output concentration waveform within this minute, determine the number of inflection points and the position i, and perform segmented modeling:
[0075] If the gas concentration value A(i + 1) of the (i + 1)-th sampling = A(i) (first judge the two values, if the subsequent values i + 2 and i + 1 are equal, then continue to merge), it is a constant segment. Record the gas concentration mean value, quantity, data position, and characteristic information. If the gas concentration mean value is less than the threshold Thre1, it is characteristic I; if the gas concentration mean value is greater than or equal to the threshold Thre1, it is characteristic II; if the gas concentration value A(i + 1) of the (i + 1)-th sampling < A(i) or A(i + 1) > A(i), it is a monotonically increasing or decreasing segment, then update and record the initial value, average slope, and deviation value of the gas concentration, quantity, data position, and characteristic information; until the traversal ends. The linear model is A(i) = K * A(i - 1) + b, where K is the slope and b is the deviation value. Use this linear model to record the initial value, slope, deviation value, and data range. The purpose of the operation is to obtain, in this section of data, from which point (data position) it starts, how many points there are in total (quantity), plus the characteristic information, so as to roughly describe this section of data. The average slope and deviation value are obtained according to the least squares method.
[0076] The present invention performs complex data compression on the characteristics of the abnormal fluctuation state and stores the corresponding data position, initial value and slope. If the data is 1, 2, 3, 4, 5, 6, etc., the data starts from the first value (data position), the initial value is 1, the slope is 1, and the deviation value is 1; if the data is 1, 1, 1, 1, 3, 5, 7, etc., the data starts from the first value (data position), the initial value is 1, and the slope is 1; the data starts from the 4th value (data position), the initial value is 3, the slope is 1, and the deviation value is 2; the slope and deviation value are calculated by A(i)=K*A(i-1)+b, where K and b are unknown numbers, and then substitute them into A(i) and A(i-1) to calculate the average slope and deviation value.
[0077] If there is a gas leak, the data should be continuously and incrementally increased over a long period of time. By this method, the compression efficiency is increased, and the speed of the gas leakage can be judged based on the average slope and deviation value.
[0078] If the gas concentration mean M is greater than the threshold Thre1, the standard deviation σ of the concentration data is greater than the threshold Thre2, and the number of inflection points in the data segment is greater than the threshold Thre3, it means that the data waveform is relatively messy, which may be due to drastic changes in the on-site environment or damage to the equipment. This data cannot be effectively compressed, and the recording state is feature IV (messy data state). The original data is retained and subsequently analyzed under complex conditions.
[0079] For features III and IV, which are gas leakage and sensor abnormality data, rapid processing of the on-site environment is achieved by marking the features of the data segments.
[0080] Step 2: Protocol encapsulation: Perform protocol encapsulation based on the concentration data compressed in step 1.
[0081] like Figure 4 As shown, after data compression is completed, protocol encapsulation is performed with reference to the data start time, data compression result, data start feature, data end feature, etc.
[0082] The data start time primarily defines the start time of the data, facilitating time-based pattern aggregation during later data analysis. The data compression result is the spliced compressed data. The start and end features are the start and end features of the compressed data. For Feature I and Feature II, the start and end features are consistent. This facilitates data splicing and provides data feature tagging. For example, Feature IV indicates data anomalies that require prompt action.
[0083] Step 3: After completing data compression within a unit time, perform data splicing: Use a greedy algorithm to splice the features of adjacent frames to achieve cross-frame data splicing.
[0084] As shown below, data compression is not just a simple splicing of compressed data, but splicing the current frame data with the next frame data. During the splicing process, under the premise of representing the gas state at the scene, as much compressed data as possible within a unit time is included in a compressed data segment. Figure 5 As shown, if it is feature III, it is the ending feature.
[0085] 2.1 If the data feature of the current frame is feature I and the data feature of the next frame is feature I, then directly perform data splicing, retain the number of the data end feature, update the data quantity, and take the larger value of the average gas concentration;
[0086] Because the mean gas concentration M of Feature I is relatively small and the equipment environment is safe, they can be directly merged to increase the compression ratio. For example, if the data in this frame is Feature II, with a mean gas concentration of 4 and a count of 50, plus Feature I, with a mean gas concentration of 1 and a count of 10; the data in the next frame is Feature I, with a mean gas concentration of 2 and a count of 30, plus Feature II, with a mean gas concentration of 6 and a count of 30, the merged data will be: Feature II, with a mean gas concentration of 4 and a count of 50, plus Feature I, with a mean gas concentration of 2 and a count of 40, plus Feature II, with a mean gas concentration of 6 and a count of 30.
[0087] 2.2 If the data feature of the current frame is Feature I and the data feature of the next frame is Feature II, if the mean gas concentration meets the error requirement, then the data is spliced, the digits of the data end feature are retained, and the data quantity is updated; if the mean gas concentrations are inconsistent, the data are compressed and spliced separately;
[0088] The concatenation of Features I and II addresses data fluctuations that prevent concatenation due to threshold settings and is also a reflection of the greedy algorithm. Generally, the mean gas concentration of Feature II minus the mean gas concentration of Feature I must be no greater than 1. The concatenation result is: Feature Type I, with the mean gas concentration equal to the mean gas concentration of Feature I. For example, if the data in this frame is Feature II's mean value of 6 (50 counts) + Feature I's mean value of 3 (10 counts); the data in the next frame is Feature II's mean value of 4 (30 counts) + Feature I's mean value of 0 (30 counts). The resulting concatenation results in: Feature II's mean value of 6 (50 counts) + Feature I's mean value of 3 (40 counts) + Feature I's mean value of 0 (30 counts). The final concatenation result is Feature II's mean value of 6 (50 counts) + Feature I's mean value of 3 (40 counts) + Feature I's mean value of 0 (30 counts).
[0089] 2.3 If the data feature of this frame is feature type I and the data feature of the next frame is feature type III, if the data feature at the beginning of the next frame is type I, then perform data splicing according to step 2.1, retain the digital feature at the end of the data, and update the data quantity; if the data feature at the beginning of the next frame is type II, and the gas concentration mean and this frame meet the error requirements, then perform data splicing according to step 2.2; in other cases, compress the data separately and splice them.
[0090] The data at position 1 of the next frame data represents the starting position of the next frame data; for example: current frame data: feature 1 average value 2 quantity 60, next frame data: position 1 average value 2 quantity 10 + position 11 average slope 1 deviation value 1 quantity 50, then after merging it is: feature 1 average value 2 quantity 70 + position 71 average slope 1 deviation value 1 quantity 50.
[0091] like Figure 6 As shown in 2.4, if the data feature of the current frame is feature type II and the data feature of the next frame is feature type I, and if the mean gas concentration meets the error requirements, data splicing is performed according to step 2.1; in other cases, data compression and splicing are performed separately.
[0092] 2.5 If the data feature of the current frame is Feature Type II and the data feature of the next frame is Feature Type II, if the mean gas concentration is consistent, then the data is spliced, the end digit feature of the data is retained, and the data quantity is updated; if the mean volume concentration is inconsistent, then the data is compressed and spliced separately;
[0093] 2.6 If the data feature of this frame is feature type II and the data feature of the next frame is feature type III, if the starting feature of the next frame data is type I and the gas concentration mean meets the error requirements of this frame, then perform data splicing according to step 2.2; if the starting feature of the next frame data is type II and the gas concentration mean is consistent with this frame, then perform data splicing according to step 2.5, retain the data end digital feature, and update the data quantity; in other cases, compress the data separately and splice them.
[0094] like Figure 7 As shown in 2.7, if the data feature of this frame is feature type III and the data feature of the next frame is feature type I, if the feature at the end of this frame is type I, then perform data splicing according to step 2.1; if the feature at the end of this frame is type II and the mean gas concentration and the mean gas concentration of the next frame meet the error requirements, then perform data splicing according to step 2.2; in other cases, perform compressed data splicing separately.
[0095] 2.8 If the data feature of this frame is feature type III and the data feature of the next frame is feature type II, if the end feature of this frame data is type I and the mean gas concentration and the mean gas concentration of the next frame data meet the error requirements, then perform data splicing according to step 2.2; if the end feature of this frame data is type II and the mean gas concentration is consistent with the next frame data, then perform data splicing according to step 2.5. In other cases, perform compressed data splicing separately.
[0096] 2.9 If the data feature of the current frame is feature type III and the data feature of the next frame is feature type III, if the end feature of the current frame data is type I and the start feature of the next frame data is type I, then perform data splicing according to 2.1; if the end feature of the current frame data is type I and the start feature of the next frame data is type II, if the mean gas concentration meets the error requirements, then perform data splicing according to 2.2; if the end feature of the current frame data is type II and the start feature of the next frame data is type I, if the mean gas concentration meets the error requirements, then perform data splicing according to 2.2; if the end feature of the current frame data is type II and the start feature of the next frame data is type II, if the mean gas concentrations are consistent, then perform data splicing according to 2.5; if the end feature of the current frame data is type III and the start feature of the next frame data is type III, and the average slope and deviation value of the next frame data are consistent with those of the current frame data, and the initial data of the next frame data and the initial data of the previous frame data meet the following formula:
[0097] The initial data of the next frame data = the initial data of the previous frame data + the average slope * the number of features III of the previous frame data + the deviation value. Then, data splicing can be performed to update the initial value, quantity, position and other information of the data. In other cases, compressed data splicing is performed separately.
[0098] For example: This frame of data ends with Feature III, and the data is: data position 10, initial value 1, slope 1, deviation value 1, and quantity 10; the next frame of data starts with Feature III, and the data is: data position 1, initial value 11, slope 1, deviation value 1, and quantity 10; the average slope is consistent with the deviation value, and the updated data is: data position 10, initial value 1, slope 1, deviation value 1, and quantity 20.
[0099] Real example: Before compression: the end of this frame data: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, the start of the next frame data: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20; after merging: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20.
[0100] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for compressing gas detector concentration data, characterized in that: The steps are as follows: Step 1: Dynamically classify the concentration data collected by the gas detector to obtain data segments with different state characteristics, and perform data compression according to different state characteristics; Step 2: Protocol encapsulation: perform protocol encapsulation based on the concentration data compressed in step 1; Step 3: After completing the data compression within the storage period, a greedy algorithm is used to splice the features of adjacent frames to achieve cross-frame data splicing.
2. The method for compressing gas detector concentration data according to claim 1, characterized in that: The method for performing data compression according to different state characteristics in step 1 is: a. If the gas concentration mean M of the concentration data within a storage cycle is less than the threshold Thre1, the gas detector is in normal detection state, recorded as feature I, and the gas concentration mean M and the number of concentration values n are recorded; b. If the mean gas concentration M of the concentration data within a storage cycle is greater than the threshold Thre1 and the standard deviation σ is less than the threshold Thre2, the gas detector is detecting normally but has a certain amount of drift, indicating a drift state. This is recorded as Feature II, and the mean gas concentration M and the number of gas samples are recorded. c. If the mean gas concentration M of the concentration data within a storage cycle is greater than the threshold Thre1, and the standard deviation σ of the concentration data is greater than the threshold Thre2, perform inflection point analysis on the collected data segment. If the number of inflection points is less than the threshold Thre3, it indicates that there are large fluctuations within the data segment, indicating an abnormal fluctuation state. Data compression is performed using a complex data compression method, and the recorded state is recorded as Feature III. d. If the mean gas concentration M of the concentration data within a storage cycle is greater than the threshold Thre1, the standard deviation σ of the concentration data is greater than the threshold Thre2, and the number of inflection points in the data segment is greater than the threshold Thre3, the data is in a chaotic state and recorded as feature IV. The data in the data segment is retained.
3. The method for compressing gas detector concentration data according to claim 2, characterized in that: The mean gas concentration: Where M is the average gas concentration of the environment where the gas detector is located, A(i) is the gas concentration value of the i-th sampling, and n is the number of times the environmental concentration is collected during the storage period; The calculation formula of the standard deviation σ is: The threshold Thre1 is smaller than the measurement error of the device, and the number is the number of gas concentration values in the time period; The threshold Thre2 is determined by the dispersion coefficient, where the dispersion coefficient Cv=σ / M.
4. The method for compressing gas detector concentration data according to claim 2 or 3, characterized in that: The inflection point analysis is a rough fitting of the waveform of the data. The waveform of the abnormal fluctuation state is bell-shaped or half-bell-shaped. The larger or smaller value in the concentration data is found through inflection point analysis. The method for determining the inflection point is as follows: calculate the intermediate value G(i) = (A(i) - A(i-1)) * (A(i+1) - A(i)). If the intermediate value G(i) < 0, the position i is the inflection point; A(i-1), A(i), and A(i+1) represent the gas concentration values of the i-1th, i-th, and i+1th samplings, respectively. The threshold Thre3 is determined according to the length of the storage period and the sensor characteristics.
5. The method for compressing gas detector concentration data according to claim 4, characterized in that: The method for performing data compression by the complex data compression method is: traversing the concentration data within a storage cycle, determining the number and position i of the inflection points, and performing segmented modeling: If the gas concentration value A(i + 1) of the (i + 1)-th sampling is equal to A(i), it is a constant segment. Record the average value M of the gas concentration, the quantity, and the characteristic information of the data position. If the average value M of the gas concentration is less than the threshold Thre1, it is Feature I; if the average value of the gas concentration is greater than or equal to the threshold Thre1, it is Feature II. If the gas concentration value A(i + 1) of the (i + 1)-th sampling is less than A(i) or A(i + 1) > A(i), the concentration data is a monotonically increasing or decreasing segment. Update and record the initial value, slope, deviation value, quantity, and characteristic information of the data position of the concentration data; until the traversal ends. The linear model of the monotonically increasing or decreasing segment is A(i) = K * A(i - 1) + b, where K is the slope and b is the deviation value. Use the linear model to record the initial value, slope, deviation value, and data range of the concentration data; the slope and deviation value are obtained according to the least squares method.
6. The method for compressing gas detector concentration data according to any one of claims 1 to 3 and 5, characterized in that: Perform protocol encapsulation by referring to the start time of the concentration data, the data compression result, the start feature of the data, and the end feature of the data.
7. The method for compressing gas detector concentration data according to claim 6, characterized in that: The method of data splicing includes: 1) If the data feature of this frame is Feature I and the data feature of the next frame is Feature I, directly perform data splicing: retain the number of the data feature, update the data quantity, and take the larger value of the average gas concentration. 2) If the data feature of this frame is Feature I and the data feature of the next frame is Feature II, if the average value of the gas concentration meets the error requirement, perform data splicing, retain the number of the data feature, and update the data quantity; if the average values of the gas concentration are inconsistent, compress the data for splicing separately. 3) If the data feature of this frame is Feature I and the data feature of the next frame is Feature III, if the start data feature of the next frame is Type I, directly perform data splicing according to 1); if the start data feature of the next frame is II and the average value of the gas concentration and this frame meet the error requirement, perform data splicing according to 2); in other cases, compress the data for splicing separately.
8. The method for compressing gas detector concentration data according to claim 7, characterized in that: The method of data splicing includes: 4) If the data feature of this frame is Feature II and the data feature of the next frame is Feature I, if the average value of the gas concentration meets the error requirement, perform data splicing according to 1); in other cases, compress the data for splicing separately. 5) If the data feature of this frame is Feature II and the data feature of the next frame is Feature II, if the average values of the gas concentration are the same, perform data splicing: retain the number of the data feature and update the data quantity; if the average values of the gas concentration are inconsistent, compress the data for splicing separately. 6) If the data feature of this frame is Feature II and the data feature of the next frame is Feature III, if the start feature of the next frame data is I and the average value of the gas concentration and this frame meet the error requirement, perform data splicing according to 2); if the start feature of the next frame data is Type II and the average value of the gas concentration and this frame are the same, perform data splicing: retain the feature of the data number and update the data quantity; in other cases, compress the data for splicing separately.
9. The method for compressing gas detector concentration data according to claim 1, characterized in that: The method of data splicing includes: 7) If the data feature of the current frame is Feature III, and the data feature of the next frame is Feature I, and if the ending feature of the current frame data is Type I, then perform data splicing according to 1); if the ending feature of the current frame data is Type II, and the gas concentration mean and the data mean of the next frame meet the error requirements, then perform data splicing according to 2); in other cases, perform compressed data splicing separately; 8) If the data feature of the current frame is Feature III and the data feature of the next frame is Feature II, if the ending feature of the current frame data is Type I and the gas concentration mean and the gas concentration mean of the next frame data meet the error requirements, then perform data splicing according to 2); if the ending feature of the current frame data is Type II and the gas concentration mean is consistent with the next frame data, then perform data splicing according to 5); in other cases, perform compressed data splicing separately; 9) If the data feature of this frame is feature III and the data feature of the next frame is feature III, if the biological ending feature of this frame data is I and the starting feature of the next frame data is I, then data splicing is performed according to 1); if the ending feature of this frame data is type I and the starting feature of the next frame data is II, if the mean gas concentration meets the error requirement, then data splicing is performed according to 2); if the ending feature of this frame data is II and the starting feature of the next frame data is I, if the mean gas concentration meets the error requirement, then data splicing is performed according to 2); if the ending feature of this frame data is II and the starting feature of the next frame data is II, if the mean gas concentration is consistent, then data splicing is performed according to 5); if the ending feature of this frame data is III and the starting feature of the next frame data is III, and the average slope and deviation value of the next frame data are consistent with the current frame data, and the initial data of the next frame data and the initial data of the previous frame data meet the continuity requirements, data splicing can be performed to update the initial value, quantity, and position of the concentration data; in other cases, data splicing is performed separately.
10. The method for compressing gas detector concentration data according to claim 9, characterized in that: The initial data of the lower frame data and the initial data of the upper frame data meet the continuity requirement: initial data of the lower frame data = initial data of the upper frame data + average slope * number of features III of the upper frame data + deviation value.
Citation Information
Patent Citations
Gas concentration detection method and device, gas detector and storage medium
CN117825314A