Compression method and system for gas consumption behavior data
By using coding and data segmentation methods, the problems of micro-flow leakage and false alarms in constant flow detection of gas meters were solved, achieving efficient data compression and accurate acquisition of gas usage behavior data, thus improving the intelligent detection capabilities of gas meters.
Patent Information
- Application Number
- CN202510887772.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-11-18
AI Technical Summary
Existing gas meters have a high false alarm rate in detecting minute flow leaks and constant flow. Traditional compression technology cannot balance high compression ratios with operational security, resulting in a bottleneck in the intelligent upgrade of gas meters.
By determining the start and end times of gas usage, encoding instantaneous flow values, dividing data segments, and compressing data segments with minor fluctuations, and combining this with the gas meter status to determine the start and end times of gas usage, invalid data storage and transmission are reduced.
This enables gas meter manufacturers to obtain accurate gas usage data from residential users, improves the detection of small and constant flow rates, reduces transmission energy consumption, and extends the service life of gas meters.
Smart Images

Figure CN120979458A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of gas meter data acquisition, and in particular to optimization of gas usage behavior data compression methods. BACKGROUND
[0002] Gas meters are generally equipped with a multi-flow interval leak detection mechanism, which triggers a valve alarm by analyzing the instantaneous flow characteristics to prevent gas leakage at the back end of the meter. However, in the case of small flow leakage and constant flow detection, the false positive rate of existing mechanisms is high, posing a safety hazard. The core contradiction lies in the fact that gas meter manufacturers urgently need flow time series data of the entire gas usage process to optimize detection algorithms, but current meters only upload daily / hourly total gas usage, resulting in the loss of key details. If full-quantity data is uploaded in real time, there will be a transmission energy crisis, which will dramatically shorten the service life of the gas meter and is not sustainable in actual scenarios.
[0003] To solve the data transmission energy problem, the industry has attempted to introduce general compression techniques. When using lossless compression methods, since gas flow is a continuous sequence of small numbers, adjacent values rarely repeat completely, and the dictionary encoding mechanism is ineffective, with a compression rate of less than 20%. When using lossy compression methods, compression is achieved by discarding high-frequency components, but the key characteristics of gas leakage are precisely in the small fluctuations in flow, and the loss of such information will directly mask the risk signals.
[0004] The essence of the above dilemma lies in the fundamental conflict between traditional compression principles and gas data characteristics: first, although the range of gas flow values is narrow, it is extremely sensitive to precision, and general discretization processing will erase key characteristics; second, the data is in a continuous and non-discrete state, with small differences between adjacent values but rarely absolute equality, resulting in the failure of compression engines that rely on repeated patterns; third, safety detection business requires high-fidelity restoration, and any distortion may cause misjudgment. This principle-based misalignment makes existing technologies unable to balance high compression rates and business safety, forming a bottleneck for the intelligent upgrade of gas meters. SUMMARY
[0005] Embodiments of the present specification provide a gas usage behavior data compression method and system, which solves the contradiction between the acquisition demand of full-quantity data and the transmission energy pressure, and enables gas meter manufacturers to obtain accurate gas usage behavior of residential users, thereby improving the mechanism for small flow and constant flow detection.
[0006] The technical solution is as follows: In a first aspect, the embodiments of the present specification provide a gas usage behavior data compression method, comprising the following steps: continuously acquiring instantaneous flow values of a gas meter at a preset interval time, and determining the start time and end time of the gas usage behavior; all the instantaneous flow values between the start time and the end time of the gas-using behavior are encoded based on a first preset encoding coefficient, and the instantaneous flow values in decimal form are converted into the encoding values in integer form; all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas-using behavior are divided into a plurality of data segments based on a preset difference range; the data segments each of which has a number of corresponding encoding values greater than a preset number are compressed to obtain a data compression segment corresponding to each compressed data segment, the data compression segment including a data segment representative value, a number of encoding values and a compression feature symbol; the compression data of the gas-using behavior is output based on all the data segments that have not been compressed and all the data compression segments between the start time and the end time of the gas-using behavior.
[0007] As a preferred solution, the compression data includes the start time of the gas-using behavior and at least one data segment that has not been compressed and / or at least one data compression segment arranged in the order of acquisition.
[0008] As a preferred solution, the method further comprises: acquiring the gas pressure and the gas temperature corresponding to the start time of the gas-using behavior; The compression data further includes the gas pressure and the gas temperature corresponding to the start time of the gas-using behavior.
[0009] As a preferred solution, the compression data further includes a separation feature symbol located at the head or tail of the compression data, and the compression feature symbol and the separation feature symbol are two different values in hexadecimal.
[0010] As a preferred solution, the method further comprises: the encoding values greater than the compression feature symbol or the separation feature symbol among all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas-using behavior are encoded based on a second preset encoding coefficient, and the quotient and the remainder are obtained by dividing the encoding value by the second preset encoding coefficient, and the quotient and the remainder are used as new encoding values; The second preset encoding coefficient is less than or equal to the upper limit of the encoding value.
[0011] As a preferred solution, the method further comprises: The first preset encoding coefficient is acquired based on the application scenario of the gas meter, the application scenario includes a domestic scenario and a commercial scenario, and the instantaneous flow value is encoded based on the first preset encoding coefficient corresponding to the domestic scenario to obtain the encoding value in integer form, which is less than the compression feature symbol and the separation feature symbol.
[0012] As a preferred solution, the continuously obtaining the instantaneous flow value at the preset interval to determine the start time and the end time of the gas using behavior comprises: Continuously obtaining the instantaneous flow value at the preset interval to determine the start time and the end time of the gas using behavior.
[0013] As a preferred solution, the dividing all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas using behavior into multiple data segments based on the preset difference range comprises: Taking the encoding value corresponding to the start time of the gas using behavior as a reference value, sequentially determining whether the subsequent encoding values are within the preset difference range of the reference value; When any subsequent encoding value is outside the preset difference range of the reference value, updating the reference value with the encoding value, and taking all the encoding values between the encoding value corresponding to the updated reference value and the previous encoding value of the encoding value corresponding to the updated reference value as a data segment, repeating the step until all the encoding values between the start time and the end time of the gas using behavior are divided into multiple data segments.
[0014] As a preferred solution, the data segment representative value of each data compression segment is the first encoding value in the corresponding data segment.
[0015] In a second aspect, the embodiments of the present specification provide a gas using behavior data compression system, comprising an acquisition module, an encoding module, a division module, a compression module and an output module: The acquisition module continuously obtains the instantaneous flow value of the gas meter at a preset interval, and determines the start time and the end time of the gas using behavior; The encoding module encodes all the instantaneous flow values between the start time and the end time of the gas using behavior based on a first preset encoding coefficient, to obtain integer form encoding values from the decimal form instantaneous flow values; The division module divides all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas using behavior into multiple data segments based on a preset difference range; The compression module compresses the data segments whose corresponding encoding values are greater than a preset number, to obtain a data compression segment corresponding to each compressed data segment, which comprises a data segment representative value, an encoding value number and a compression feature symbol; The output module outputs the compressed data of the gas using behavior based on all the data segments and all the data compression segments which have not been compressed.
[0016] In a third aspect, an electronic device is provided, including a processor and a memory; the processor is connected with the memory; the memory is configured to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the first aspect.
[0017] In a fourth aspect, a computer storage medium is provided, which stores a plurality of instructions adapted to be loaded and executed by a processor to execute the steps of the first aspect.
[0018] The technical solutions provided by some embodiments of the present specification have at least the following beneficial effects: By judging the start time and the end time of the gas usage behavior to reduce the storage of invalid data, all instantaneous flow values in the gas usage behavior are first encoded to reduce the space occupation size of a single data, and then all instantaneous flow values are divided according to the fluctuation of the instantaneous flow values to distinguish the data segment with small fluctuation and the data segment with large fluctuation, the data segment with small fluctuation is compressed, and one data segment representative value represents all data in the corresponding data segment, so as to reduce the number of data, and finally the compressed data segment and the data segment with large fluctuation are used as the compressed data of the gas usage behavior for storage, uploading, and restoration and decoding by the gas meter manufacturer, so as to improve the mechanism for detecting small flow and constant flow.
[0019] The group of gas pressure and gas temperature corresponding to the start time of the gas usage behavior is used as the user real gas environment data of the gas usage behavior to provide a basis for the gas meter manufacturer to develop a precise mechanism, and the compressed data only includes one time stamp of the start time of the gas usage behavior, so as to greatly reduce the data amount.
[0020] By selecting the first preset encoding coefficient to encode the flow range according to the application scenario of the gas meter, data overflow is avoided as much as possible under the premise of meeting data accuracy, and the encoding compression effect is improved.
[0021] In order to ensure data accuracy, the encoding value is adjusted based on the second preset encoding coefficient to avoid pollution of the data stream by the compressed marker, and to ensure reliable execution of subsequent source coding.
[0022] The start time and the end time of the gas usage behavior are jointly judged based on the state of the gas meter, to further avoid obtaining invalid data, so as to reduce invalid storage and transmission pressure. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
[0024] Figure 1 is a flow diagram of a compression method for gas behavior data provided by an embodiment of the present specification.
[0025] Figure 2 is a structural diagram of a compression system for gas behavior data provided by an embodiment of the present specification.
[0026] Figure 3 is a structural diagram of an electronic device provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present specification will be described clearly and completely below with reference to the drawings in the embodiments of the present specification.
[0028] The terms "first", "second", "third", etc. in the specification and claims of the present specification and the above drawings are used to distinguish different objects, and are not used to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed or can optionally include other steps or units inherent to the process, method, product or device.
[0029] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes can be made to the functions and arrangements of described elements without departing from the scope of the present specification. Various examples can appropriately omit, replace or add various processes or components. For example, the described methods can be executed in different order from the described order, and various steps can be added, omitted or combined. In addition, features described with respect to some examples can be combined into other examples.
[0030] The existing gas meter is not accurate enough in detecting small flow leakage and constant flow, and false positives often occur. For example, constant flow may be caused by a gas water heater, and small flow leakage may be caused by a pipeline leak. Both of them show "continuous low consumption" in the original total data, but in the actual instantaneous flow sequence, the former is a straight line and the latter is a disordered fluctuation. Gas meter manufacturers urgently need the flow time series data of the whole process of user gas consumption to optimize the detection algorithm, but the current meter only uploads the total gas consumption at the daily / hourly level, resulting in the loss of key details. If real-time full data is uploaded, it will face a transmission energy crisis, which will sharply shorten the service life of the gas meter and is not sustainable in the actual scenario.
[0031] Since the gas flow is a continuous change of decimal sequence, adjacent values rarely repeat completely, and flow fluctuations are exactly the key characteristics of small flow leakage. Therefore, the compression scheme in the prior art is not suitable for time series data similar to the characteristics of gas flow. To solve the contradiction between the acquisition demand of full data and the transmission energy pressure, help gas meter manufacturers obtain accurate gas consumption behavior of residents, and improve the mechanism of small flow and constant flow detection, the present application is proposed.
[0032] Referring to Figure 1 As shown in the flowchart of the compression method of gas consumption behavior data provided by an embodiment of the present application, at least the following steps can be included: Figure 1 Step 102, continuously acquiring the instantaneous flow value of the gas meter at a preset interval, and determining the start time and end time of the gas consumption behavior; Step 104, encoding all instantaneous flow values between the start time and end time of the gas consumption behavior based on a first preset encoding coefficient, to obtain integer-form encoding values from the decimal-form instantaneous flow values; Step 106, dividing all encoding values corresponding to all instantaneous flow values between the start time and end time of the gas consumption behavior into multiple data segments based on a preset difference range; Step 108, compressing the data segments whose respective corresponding encoding values are greater than a preset number, to obtain data compression segments each corresponding to a data compression segment including a data segment representative value, an encoding value number, and a compression feature symbol; Step 110, outputting the compressed data of the gas consumption behavior based on all uncompressed data segments and all data compression segments between the start time and end time of the gas consumption behavior.
[0033] Illustratively, the ultrasonic gas meter usually collects gas flow at a very high frequency, and in this scheme, the meter readings can be continuously acquired at preset intervals, and the instantaneous flow value can be calculated by the difference between the readings at the preset intervals. The subsequent preset intervals in this embodiment are all taken as an example of 2 seconds. In addition, the start and end of the gas usage behavior are determined by the instantaneous flow value, so as to reduce invalid storage. When the instantaneous flow value is not 0, it is determined whether the previous instantaneous flow value is 0. If the previous instantaneous flow value is not 0, it indicates that the current gas usage behavior is still continuing. If the previous instantaneous flow value is 0, it is considered that a new gas usage behavior has started, and the starting time point of the gas usage behavior is recorded. When the instantaneous flow value is 0 and the previous instantaneous flow value is not 0, it is considered that the current gas usage behavior has ended.
[0034] Illustratively, the instantaneous flow value is a continuous change decimal sequence, and in the meter, the instantaneous flow value is usually transmitted in the format of 4-byte integer + 1-byte decimal, or in the format of 1-byte integer + 1-byte decimal, but the transmission loses precision. The instantaneous flow value is mapped to an integer set through coding, so as to greatly reduce the byte occupation of a single instantaneous flow value. The smaller the preset coding coefficient is, the lower the precision of the coded data is. The larger the preset coding coefficient is, the higher the precision of the coded data is, but the byte number may be increased, and the storage and transmission pressure is increased, so it is necessary to be reasonably set.
[0035] Change it like this: Illustratively, the instantaneous flow value is a continuous change sequence value, Illustratively, if the first preset coding coefficient is 50, and the instantaneous flow value is 0.12 m³ / h, the storage comparison is as follows: the integer coding value 6 (the first preset coding coefficient * the instantaneous flow value = 6) only needs 1 byte. When the first preset coding coefficient is 50, the unit of the corresponding coding value is changed from m³ / h to 1000 / 50 L / h = 20 L / h, that is, the data precision is 20 L / h, and the gas industry recognizes that > 50 L / h belongs to the micro leakage threshold, and the data precision meets the requirements.
[0036] Illustratively, the data size of each instantaneous flow value is compressed through coding, and all the instantaneous flow values are divided according to the fluctuation of each instantaneous flow value, so as to distinguish the data segment with small fluctuation and the data segment with large fluctuation. The data segment with small fluctuation is compressed, and one data segment representative value represents all the data in the corresponding data segment, so as to reduce the number of data. Finally, the compressed data segment and the data segment with large fluctuation are taken as the compressed data of the gas usage behavior, and are stored and uploaded for the gas meter manufacturer to restore and decode, so as to improve the mechanism of micro flow and constant flow detection. The overhead of data storage and transmission is reduced. Illustratively, the data segment representative value can be a statistical calculation value such as the average value or the median of all the coding values of the compressed data segment.
[0037] For example, the expression form of the data compression segment is: (average value, compression feature symbol, number of encoding values).
[0038] For example, the sequence of all encoding values of the gas behavior is 2, 3, 6, 6, 6, 3, 7, 8, 6, 7, 1, the preset difference range is ±1, and the preset number is 2. Five data segments of (2, 3), (6, 6, 6), 3, (7, 8, 6, 7), and 1 are divided, and the compressed compressed data is (2, 3), (6, compression feature symbol, 3), 3, (7, compression feature symbol, 4), and 1. The setting of the preset number can avoid the compression operation on the data segment composed of a small number of encoding values, and the data amount after the compression operation may be greater than the data amount before the compression operation.
[0039] In an embodiment of the present specification, the compressed data includes a starting time of the gas behavior and at least one data segment not compressed and / or at least one data compression segment arranged in the order of acquisition.
[0040] For example, the starting time is only collected at the first time, the compressed data only includes the starting time of the gas behavior, and the time stamp corresponding to each instantaneous flow value is calculated through the preset interval time during subsequent restoration and decoding, thereby reducing the data dimension of subsequent compression, reducing the data amount and the encoding burden. Each data segment and each data compression segment are arranged in the order of acquisition of the instantaneous flow value, without additional sequence information.
[0041] In an embodiment of the present specification, the compression method further includes: acquiring the gas pressure and the gas temperature corresponding to the starting time of the gas behavior; The compressed data further includes the gas pressure and the gas temperature corresponding to the starting time of the gas behavior.
[0042] For example, it is difficult to simulate the user real gas environment data, which is one of the reasons why the gas meter manufacturer cannot develop a precise mechanism for detecting small flow leakage and constant flow. Therefore, the gas behavior data is collected, and the gas pressure and the gas temperature are collected as user real gas environment data.
[0043] For example, considering that the pressure and temperature of the gas change little and small fluctuations have little effect on the instantaneous flow, only the starting time of the gas behavior is collected as the environmental information corresponding to the entire compressed data, thereby reducing the data amount.
[0044] In an embodiment of the present specification, the compressed data further includes a separation feature symbol located at the head or tail of the compressed data, and the compression feature symbol and the separation feature symbol are two different values in hexadecimal numbers.
[0045] Illustratively, the compression feature symbol represents that there is compression calculation here, and the separation feature symbol represents the boundary of the two gas behaviors. In engineering practice, register configuration, memory address, and communication protocol are widely used in embedded development. Two values are selected from the hexadecimal number as the compression feature symbol and the separation feature symbol as the identifier.
[0046] It can be understood that, since the feature symbol occupies the corresponding value, in order to avoid the feature symbol polluting the data stream, a larger value that can be represented by a single byte (8 bits) in hexadecimal should be selected as the feature symbol, and more continuous values should be left to ensure reliable execution of subsequent encoding.
[0047] Preferably, the compression feature symbol is 0xFE (254), and the separation feature symbol is 0xFF (255).
[0048] In an embodiment of the present specification, all instantaneous flow values between the start time and the end time of the gas behavior are encoded based on the first preset encoding coefficient, and the instantaneous flow value is converted into an encoded value in the form of an integer. Then, the method further comprises: The second preset encoding coefficient is less than or equal to the encoding upper limit value.
[0049] Illustratively, due to the presence of the feature symbol, when the first preset encoding coefficient is not properly selected, the obtained encoded value will be greater than or equal to the feature symbol, causing analysis conflict. Therefore, the encoded value greater than the feature symbol needs to be encoded twice, so as to avoid the reserved byte (0xFE / 0xFF) to prevent analysis conflict.
[0050] Illustratively, if the first preset encoding coefficient is 50, and the instantaneous flow value is 12.345 m³ / h, then the corresponding encoded value is 12.345*50=617, which is greater than 0xFE (254), and therefore needs to be encoded twice. If the second preset encoding coefficient is 250, then 617 / 250=2 (0x02) and 117 (75) are taken as the new encoded value, which is represented as 0x0275. When decoding, the same way of decoding is used, instead of directly decoding the double-byte 0x0275 to obtain the encoded value 629.
[0051] In an embodiment of the present specification, the compression method further comprises: The first preset coding coefficient is obtained based on the application scenario of the gas meter, the application scenario includes a civil scenario and a commercial scenario, and an instantaneous flow value is encoded based on the first preset coding coefficient corresponding to the civil scenario to obtain an encoded value in an integer form, which is less than a compression feature symbol and the separation feature symbol.
[0052] Illustratively, since the respective flow peak values of the civil scenario and the commercial scenario are quite different, the scenario design is increased, and the coding coefficients are designed for the civil and commercial scenarios respectively. The first preset coding coefficient is set according to the application scenario of the gas meter, so as to improve the coding compression effect as much as possible on the premise of meeting the data accuracy, and to avoid data overflow by coding adaptation to the flow range.
[0053] Illustratively, the resident user meter specification is generally G2.5, and the maximum flow defined by the standard is 4m 3 / h, according to the data collected from the commonly used gas equipment at home, and considering the reduction of the last transmission data, it is hoped that the encoded value corresponding to each instantaneous flow value of the civil scheme is a single byte, and the first preset coding coefficient corresponding to the civil scenario is set based on this.
[0054] Illustratively, the first preset coding coefficient corresponding to the civil scenario is 50, and the precision is 20L / h, and the first preset coding coefficient corresponding to the commercial scenario is 500, and the precision is 2L / h. In the case that the compression feature symbol is 0xFE (254), the separation feature symbol is 0xFF (255), and 0xFD is idle, the maximum available coding value is 252 (0xFC), 252 / 50=5.04m 3 / h is sufficient to cover the normal gas flow in the civil scenario, a single byte can cover the flow during normal gas use, and the data precision of 20L / h is sufficient, so for the civil gas meter, the coding compression rate is exchanged for a small part of precision, and the encoded value is only one byte; and for industry and commerce, since the flow is larger than that of the civil scenario, if the encoded value is constrained to a single byte, the data precision in the commercial scenario will be greatly reduced, and the key details will be lost, therefore, only double-byte coding can be used to ensure the precision requirement, and when the instantaneous flow value is 12.345m³ / h, the encoded value corresponding to the commercial scenario is 12.345*500=6172, 6172 is greater than 0xFE (254), so secondary coding is required. If the second preset coding coefficient is 250, then 6172 / 250=24 (0x18) and 172 (AC) are taken as the new encoded value, which is represented as 0x18AC.
[0055] In an embodiment of the present specification, the instantaneous flow value is continuously obtained at a preset interval time to determine the start time and the end time of the gas use behavior, which comprises: The gas meter state and the instantaneous flow value are continuously obtained at a preset interval time to determine the start time and the end time of the gas use behavior.
[0056] Illustratively, the gas usage behavior is determined in combination with the gas meter state. The gas usage behavior is obtained only when the preset condition is met, for example, the current time of the gas meter is not abnormal, the current flow acquisition sensor and module are not in an abnormal state, and the instantaneous flow value is not zero to confirm the start time and end time of the gas usage behavior, thereby further avoiding obtaining invalid data and reducing invalid storage and transmission pressure.
[0057] In an embodiment of the present specification, all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas usage behavior are divided into a plurality of data segments based on a preset difference range, comprising: Taking the encoding value corresponding to the start time of the gas usage behavior as a reference value, it is sequentially determined whether the subsequent encoding values are within the preset difference range of the reference value; When any subsequent encoding value is outside the preset difference range of the reference value, the reference value is updated with the encoding value, and all the encoding values between the encoding value corresponding to the updated reference value and the previous encoding value of the encoding value corresponding to the reference value before the update are taken as a data segment. The above step is repeated until all the encoding values between the start time and the end time of the gas usage behavior are divided into a plurality of data segments.
[0058] Illustratively, the sequence of all the encoding values of a gas usage behavior is 2, 3, 6, 6, 6, 3, 7, 8, 6, 7, 1, and the preset difference range is ±1. First, take 2 as the reference value, sequentially determine whether the subsequent encoding values are within the range of 2±1, and divide the data segment (2, 3). Then, take 6 as the new reference value, sequentially determine whether the subsequent encoding values are within the range of 6±1, and divide the data segment (6, 6, 6). Then, take 3 as the new reference value, sequentially determine whether the subsequent encoding values are within the range of 3±1, and the next encoding value 7 is not within the range, so 3 forms a data segment, and so on.
[0059] Illustratively, using this method can realize the steps of instantaneous flow value acquisition, encoding, data segment division, and data segment compression simultaneously. The real-time performance is improved, the risk of data accumulation and data loss is avoided, the resource occupation is reduced, the memory is saved, and the computing load is balanced.
[0060] In an embodiment of the present specification, the data segment representative value of each data compression segment is the first encoding value in the corresponding data segment.
[0061] Illustratively, the first encoding value in the data segment is directly taken as the data segment representative value, without the need for statistical calculation of the encoding values in the data segment. When the preset difference range is reasonable, the deviation of the data segment representative value can be ignored, thereby reducing the calculation amount.
[0062] Working principle: Whether or not in use, every 2 seconds are determined, if the current day stored compression data exceeds a certain number or gas meter date abnormal stop collecting gas behavior, and then determine the current instantaneous flow value acquisition sensor, module or scheme is in abnormal state, if in abnormal state, think the current instantaneous flow value is 0, if the current instantaneous flow value is not 0, determine whether the last time instantaneous flow value is 0, if the last time instantaneous flow value is 0, think that a new gas behavior has started, record the starting time of this gas behavior, starting time pipe gas pressure, gas temperature, subsequent in stop this gas behavior before, every 2 seconds record once instantaneous flow value. When the instantaneous flow value is 0 or the time point of statistics exceeds a certain number, stop collecting this gas behavior, in this case, if there is an instantaneous flow value at the next time point, it is considered to be a new behavior of gas.
[0063] Synchronous instantaneous flow value encoding, dividing data segment, compressing data segment, finally compressing the compressed data compression segment and the data segment not compressed according to time sequence into complete compression data sequence, and storing in the gas meter, subsequent upload to remote system.
[0064] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be executed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are possible or can be advantageous.
[0065] Next, please refer to Figure 2 , Figure 2 The structure of a gas behavior data compression system provided by an embodiment of the present specification is shown.
[0066] The compression system 200 includes an acquisition module 201, an encoding module 202, a division module 203, a compression module 204, and an output module 205: The acquisition module 201 continuously acquires the instantaneous flow value of the gas meter at a preset interval, and determines the starting time and ending time of the gas behavior; The encoding module 202 encodes all instantaneous flow values between the starting time and ending time of the gas behavior based on a first preset encoding coefficient, to obtain integer form encoding values from decimal form instantaneous flow values; The division module 203 divides all encoding values corresponding to all instantaneous flow values between the starting time and ending time of the gas behavior into multiple data segments based on a preset difference range; The compression module 204 compresses the data segments whose respective corresponding number of encoding values is greater than the preset number among all data segments, to obtain a data compression segment of each compressed data segment, which includes a data segment representative value, a number of encoding values and a compression feature symbol. The output module 205 outputs the compressed data of the applying gas behavior based on all the data segments and all the data compression segments which are not compressed between the start time and the end time of the applying gas behavior.
[0067] Each of the embodiments in the specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the compression system embodiment, since it is basically similar to the compression method embodiment, the description is relatively simple, and the relevant parts can be referred to the part of the compression method embodiment.
[0068] Please refer to Figure 3 The embodiment of the specification shown provides a structural schematic diagram of an electronic device.
[0069] As Figure 3 shown, the electronic device 300 can include at least one processor 301, at least one network interface 304, a user interface 303, a memory 305 and at least one communication bus 302.
[0070] The communication bus 302 can be used to realize the connection and communication of the above-mentioned components.
[0071] The user interface 303 can include a key, and the optional user interface can also include a standard wired interface, a wireless interface.
[0072] The network interface 304 can include but is not limited to a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0073] The processor 301 can include one or more processing cores. The processor 301 connects various parts within the entire electronic device 300 by various interfaces and lines, and performs various functions of the electronic device 300 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Alternatively, the processor 301 can be implemented in at least one hardware form of a DSP, an FPGA, a PLC. The processor 301 can integrate one or a combination of a CPU, a GPU, and a modem. Among them, the CPU mainly processes operating systems, user interfaces, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 301, but can be realized by a separate chip.
[0074] The memory 305 can include a RAM and can also include a ROM. Alternatively, the memory 305 includes a non-transitory computer readable medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store data involved in the above-mentioned various method embodiments, etc. The memory 305 can also be at least one storage device located away from the aforementioned processor 301. The memory 305 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a compression application. The processor 301 can be used to call the compression application stored in the memory 305, and execute the steps of the compression method mentioned in the above-mentioned embodiments.
[0075] The embodiments of the present specification also provide a computer readable storage medium, which stores instructions, when running on a computer or a processor, causes the computer or the processor to execute the steps of one or more of the above-mentioned compression method embodiments. The various constituent modules of the above-mentioned electronic device, if realized in the form of software function units and sold or used as independent products, can be stored in the computer readable storage medium.
[0076] In the above embodiments, all or part of the methods can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the methods can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in or transmitted by a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a digital versatile disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
[0077] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by a computer program instructing related hardware, which can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. The storage medium includes ROM, RAM, magnetic or optical disks, and various program code storage media. In the case of no conflict, the technical features in the embodiments and the embodiments can be combined arbitrarily.
[0078] The above-described embodiments are merely described as the preferred embodiments of the specification, and do not limit the scope of the specification. Without departing from the design spirit of the specification, various modifications and improvements of the technical solutions of the specification made by those of ordinary skill in the art should fall within the protection scope of the claims of the specification.
Claims
1. A method for compressing data of a gas behavior, characterized in that, The method comprises the following steps: acquiring instantaneous flow values of the gas meter at preset intervals, and determining the start time and the end time of the gas usage behavior; encoding all the instantaneous flow values between the start time and the end time of the gas usage behavior based on a first preset encoding coefficient, and obtaining integer-form encoding values from the decimal-form instantaneous flow values; dividing all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas usage behavior into multiple data segments based on a preset difference value range; compressing the data segments whose respective corresponding encoding values are greater than a preset number, and obtaining data compression segments each corresponding to a data compression segment representative value, an encoding value number and a compression feature symbol; outputting compressed data of the gas usage behavior based on all the data segments that have not been compressed and all the data compression segments between the start time and the end time of the gas usage behavior.
2. The method for compressing gas behavior data according to claim 1, wherein, The compressed data comprises the start time of the gas usage behavior and at least one data segment that has not been compressed and / or at least one data compression segment arranged in the order of acquisition.
3. A method of compressing data for gas behavior according to claim 2, wherein, The method further comprises: acquiring the gas pressure and the gas temperature corresponding to the start time of the gas usage behavior; The compressed data further comprises the gas pressure and the gas temperature corresponding to the start time of the gas usage behavior.
4. The method for compressing gas behavior data according to claim 2, wherein, The compressed data further comprises a separation feature symbol located at the head or the tail of the compressed data, and the compression feature symbol and the separation feature symbol are two different values in hexadecimal numbers.
5. A method of compressing data for gas behavior according to claim 4, wherein, The method further comprises, after the encoding of all the instantaneous flow values between the start time and the end time of the gas usage behavior based on the first preset encoding coefficient and the obtaining of the integer-form encoding values from the decimal-form instantaneous flow values: performing secondary encoding on each encoding value greater than the compression feature symbol or the separation feature symbol among all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas usage behavior based on a second preset encoding coefficient, obtaining quotient and remainder by dividing the encoding value by the second preset encoding coefficient, and taking the quotient and the remainder as new encoding values; The second preset encoding coefficient is less than or equal to the upper limit of the encoding value.
6. A method of compressing data of a gas operation according to claim 5, wherein, The method further comprises: acquiring the first preset encoding coefficient based on the application scenario of the gas meter, the application scenario comprising a domestic scenario and a commercial scenario, and the instantaneous flow value is encoded into an integer-form encoding value based on the first preset encoding coefficient corresponding to the domestic scenario, which is less than the compression feature symbol and the separation feature symbol.
7. A method of compressing data of a gaseous behavior according to any one of claims 1 to 6, characterized in that, The method of acquiring the instantaneous flow values at preset intervals to determine the start time and the end time of the gas usage behavior comprises: acquiring the state of the gas meter and the instantaneous flow values at preset intervals to determine the start time and the end time of the gas usage behavior.
8. The method for compressing gas behavior data according to claim 1, wherein, The method of dividing all the encoding values corresponding to all the instantaneous flow values between the start time and the end time of the gas usage behavior into multiple data segments based on a preset difference value range comprises: taking the encoding value corresponding to the start time of the gas usage behavior as a reference value, and sequentially determining whether the subsequent encoding values are within a preset difference value range of the reference value. When any subsequent encoding value is outside the preset difference range of the reference value, the reference value is updated with the encoding value, and all encoding values between the encoding value corresponding to the reference value before the update and the previous encoding value corresponding to the encoding value corresponding to the reference value after the update are taken as a data segment, and the step is repeated until all encoding values between the starting time and the ending time of the gas usage behavior are divided into multiple data segments.
9. A method of compressing data for gas behavior according to claim 8, wherein, The data segment representative value of each data compression segment is the first encoding value in the corresponding data segment.
10. A system for compressing data of a gas behavior, characterized in that, The method comprises an acquisition module, an encoding module, a division module, a compression module, and an output module. The acquisition module continuously acquires the instantaneous flow value of the gas meter at a preset interval, and determines the starting time and the ending time of the gas usage behavior. The encoding module encodes all instantaneous flow values between the starting time and the ending time of the gas usage behavior based on a first preset encoding coefficient, to obtain integer-form encoding values from the decimal-form instantaneous flow values. The division module divides all encoding values corresponding to all instantaneous flow values between the starting time and the ending time of the gas usage behavior into multiple data segments based on a preset difference range. The compression module compresses data segments whose corresponding encoding values are greater than a preset number, to obtain data compression segments each comprising a data segment representative value, a number of encoding values, and a compression feature symbol. The output module outputs compressed data corresponding to the gas usage behavior based on all uncompressed data segments and all data compression segments between the starting time and the ending time of the gas usage behavior.