Efficient compression and transmission method, terminal and system for ultrasonic water meter data

CN122513830BActive Publication Date: 2026-09-18MAXTOR INSTR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610975649.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-02
Publication Date
2026-09-18
Estimated Expiration
2046-07-02

AI Technical Summary

Technical Problem

[0007]本发明所要解决的技术问题是:针对现有超声水表数据传输压缩率不足的缺陷,提供一种能够充分利用超声水表数据的物理特性和时间序列特征,实现极致压缩传输的方法、终端及系统

Benefits of technology

通过字段索引固化机制将Key列表升级为永久数据包,仅传输一次即永久复用,从根本上消除了重复Key的传输开销;

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The application discloses a kind of ultrasonic water meter data efficient compression transmission method, terminal and system, belong to intelligent water meter and data compression technical field. The original data record of ultrasonic water meter is collected, and each record at least includes six fields such as time stamp, instantaneous flow, cumulative flow, flow rate, signal intensity and instrument state;Field number mapping table is constructed based on field name, as the first compression package;Using the fixed period characteristics of time stamp, extracting reference time stamp and transmitting subsequent time stamp by difference value coding;Remaining numerical field is arranged in sequence to form numerical matrix according to mapping table, and two-stage difference strategy is used-adjacent difference is used for normal simulation quantity field, and cumulative flow field uses period increment difference distribution;State field is encoded using enumeration mapping;The above compressed data is packaged as second compression package and transmitted to cloud end;Cloud end restores original data record according to first compression package and second compression package, and the extreme compression efficiency and data integrity are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart water meters and data compression and transmission technology, and in particular to a method, terminal and system for efficient compression and transmission of ultrasonic water meter data. Background Technology

[0002] Ultrasonic water meters measure flow velocity and flow rate by utilizing the time difference between the propagation of ultrasonic waves in a fluid with and against the current. They offer advantages such as high accuracy, low pressure loss, and no mechanical wear, making them a core sensing terminal in smart water management systems. In practical deployments, ultrasonic water meters are typically installed in pipe wells, meter boxes, etc., and mostly use NB-IoT (Narrowband Internet of Things) for data transmission. This presents communication challenges such as extremely low bandwidth (uplink speeds typically tens of kbps), limited battery power consumption, and high data acquisition frequency (30 seconds to 5 minutes per acquisition).

[0003] In existing technologies, ultrasonic water meters typically transmit data using JSON strings or fixed-length binary concatenation. JSON records are approximately 140-160 bytes each, while binary records are approximately 18 bytes each. However, neither of these methods fully utilizes the data relationships between multiple records for further compression. Especially for numerical fields such as cumulative flow rates exceeding tens of thousands, transmitting a complete 4-byte floating-point number each time results in wasted bytes.

[0004] Existing patent CN 114884881 A proposes a general data compression and transmission method, which achieves compression by separating the request address (Key) and request content (Value) and performing differential calculation. However, this method is geared towards general HTTP request scenarios, requiring the retransmission of the Key list for each session cycle, making it unsuitable for scenarios like ultrasonic water meters where the data limit field is fixed over a long period. Furthermore, this method does not provide special processing for metering data with physical cumulative significance, does not address the compression of the timestamp field, and does not implement a batch data packet transmission structure.

[0005] Therefore, it is necessary to propose a compression transmission scheme that is deeply optimized for the characteristics of ultrasonic water meter data. Summary of the Invention

[0006] The purpose of this section is to outline some aspects of embodiments of the present invention and to briefly describe some preferred embodiments. Simplifications or omissions may be made in this section, as well as in the abstract and title of this application, to avoid obscuring the purpose of these documents; however, such simplifications or omissions should not be construed as limiting the scope of the invention.

[0007] The technical problem to be solved by this invention is to provide a method, terminal and system that can fully utilize the physical characteristics and time series features of ultrasonic water meter data to achieve extreme compression transmission, addressing the deficiency of insufficient compression rate in existing ultrasonic water meter data transmission.

[0008] To solve the above technical problems, the present invention provides the following technical solution: a method for efficient compression and transmission of ultrasonic water meter data, comprising the following steps: Step 1: Collect multiple raw data records from the ultrasonic water meter terminal, each raw data record including at least timestamp, instantaneous flow rate, cumulative flow rate, flow velocity, signal strength, and meter status fields; extract all field names and assign unique field numbers, construct a field number mapping table, and encapsulate the field number mapping table into a first compressed package, transmit it to a cloud server through a control channel, and persistently store it; Step 2: Extract the timestamp of the first record from the N raw data records in the current batch as the reference timestamp T. base For the timestamp t of the i-th record i Calculate the difference Δt i =t i -T base Where i = 2,3,...,N, and variable-length integer encoding is used for each Δt. i Encode; Step 3: Arrange the numerical fields of the N original data records after removing the timestamps into an N-row × (M-1)-column numerical matrix according to the field number sequence defined in the field number mapping table, where M is the total number of fields and M-1 is the total number of numerical fields; define the first row of the numerical matrix as the base data row, and encode the field values ​​in the base data row with the original precision; starting from the second row of the numerical matrix, perform adjacent difference differential for the conventional analog quantity fields to generate the difference value of each conventional analog quantity field, and perform periodic increment differential for the cumulative flow field to generate the cumulative flow increment value; set the Δt i The encoding, each differential value, the cumulative flow increment value, and the instrument status enumeration encoding are combined in a fixed order to form a differential data row; Step 4: The reference timestamp T is... base Step 5: The reference data row and all the differential data rows are concatenated sequentially to generate a second compressed package, which is then transmitted to the cloud server via the NB-IoT network; Step 6: After receiving the second compressed package, the cloud server parses it to obtain the reference timestamp T. base The baseline data row and each of the differential data rows, combined with the locally stored field number mapping table and status enumeration dictionary, are used to restore the complete original data record through incremental accumulation inverse operation.

[0009] As a preferred embodiment of the efficient compression and transmission method for ultrasonic water meter data described in this invention, the conventional analog quantity fields in step 3 include instantaneous flow rate, flow velocity, and signal strength. The adjacent difference calculation method is as follows: the value of the conventional analog quantity field in the current row is subtracted from the corresponding field value in the previous row, and the resulting difference is encoded using a half-precision floating-point number or a signed integer.

[0010] As a preferred embodiment of the efficient compression and transmission method for ultrasonic water meter data described in this invention, the periodic increment difference calculation method of the cumulative flow field in step 3 is as follows: the cumulative flow value of the current row is subtracted from the cumulative flow value of the previous row, and the difference is encoded using a half-precision floating-point number; the physical meaning of the cumulative flow increment value is the increase in water flow volume within the time interval between the current record and the previous record.

[0011] As a preferred embodiment of the efficient compression and transmission method for ultrasonic water meter data described in this invention, the specific method of variable-length integer encoding in step 2 is as follows: The variable-length integer encoding of Δt... i Each 7 bits of the binary value is used as a coding unit. Each coding unit is stored in the lower 7 bits of a byte. The highest bit of the byte is used as a continuation flag. When the byte is the last coding unit, the continuation flag is 0, otherwise the continuation flag is 1.

[0012] As a preferred embodiment of the efficient compression and transmission method for ultrasonic water meter data described in this invention, in step 3, the instrument status enumeration encoding maps the instrument status string to a fixed-length binary code through the status enumeration dictionary. The construction of the status enumeration dictionary and the construction of the field number mapping table are carried out simultaneously and are encapsulated together in the first compressed package for transmission.

[0013] As a preferred embodiment of the efficient compression and transmission method for ultrasonic water meter data described in this invention, the message structure of the second compressed packet in step 4 includes, in byte stream order: packet type identifier field, batch sequence number field, record quantity field N, and reference timestamp field T. base The system consists of a baseline data row field and N-1 sequentially arranged differential data row fields; wherein the package type identifier field, batch sequence number field, and record quantity field each occupy 1 byte, and the baseline timestamp T... base The field occupies 4 bytes.

[0014] As a preferred embodiment of the efficient compression and transmission method for ultrasonic water meter data described in this invention, step 5, the incremental accumulation inverse operation, includes: based on the reference timestamp T base and each of the stated Δt i Restore the timestamp, add the difference value of the regular analog quantity field in the previous row to restore the regular analog quantity field value in the current row, add the cumulative flow value in the previous row to the cumulative flow increment value in the current row to restore the cumulative flow value in the current row, and restore the enumeration code to the instrument status string according to the status enumeration dictionary.

[0015] As a preferred embodiment of the ultrasonic water meter data high-efficiency compression and transmission method described in this invention, step 6 is further included after step 5: the cloud server calculates the expected cumulative flow increment using the restored instantaneous flow value and the time interval of each record, compares the expected cumulative flow increment with the restored cumulative flow increment value, and when the absolute value of the difference between the two exceeds a preset threshold, the data record is determined to be abnormal and an alarm is triggered.

[0016] To solve the above-mentioned technical problems, the present invention also provides the following technical solution: a high-efficiency compressed transmission terminal for ultrasonic water meter data, comprising: a data acquisition module, used to acquire and cache the raw data records of the ultrasonic water meter at fixed intervals, each raw data record including at least timestamp, instantaneous flow rate, cumulative flow rate, flow velocity, signal strength, and meter status fields; a field indexing and fixing module, used to extract all field names and assign unique field serial numbers, construct a field number mapping table, and encapsulate the field number mapping table into a first compressed package and send it through a communication module; and a timestamp differential encoding module, used to extract a reference timestamp T from the N raw data records of the current batch processing. base Calculate the difference Δt between the timestamps of the subsequent N-1 records. i Encoding is performed using variable-length integer encoding; the numerical matrix differencing module is used to arrange the timestamp-extracted numerical fields into a numerical matrix according to the field numbering order defined in the field numbering mapping table, using the first row of the numerical matrix as the base data row and encoding it with the original precision, and from the second row onwards performing adjacent difference differencing on the conventional analog quantity fields and periodic incremental differencing on the cumulative flow field, and then using the Δt... i The encoding, differential values, and instrument status enumeration encoding are combined into differential data rows; the batch packaging module is used to package the reference timestamp T base The reference data line and all the differential data lines are sequentially concatenated into a second compressed package; the communication module is used to send the first compressed package and the second compressed package through the NB-IoT network.

[0017] To solve the above-mentioned technical problems, the present invention also provides the following technical solution: a high-efficiency compressed transmission system for ultrasonic water meter data, including the aforementioned terminal and a cloud server, wherein the cloud server includes: a message receiving and parsing module, used to receive the second compressed packet and parse out the reference timestamp T. base The baseline data row and each of the differential data rows; the data restoration module, used to restore the complete original data record by incremental accumulation inverse operation based on the field number mapping table and status enumeration dictionary stored locally.

[0018] This invention provides a method, terminal, and system for efficient compression and transmission of ultrasonic water meter data, which has the following beneficial effects: By using a field indexing persistence mechanism, the key list is upgraded to a permanent data packet, which can be permanently reused after being transmitted only once, fundamentally eliminating the transmission overhead of duplicate keys; By using a two-level differential strategy, conventional analog quantities and cumulative metering quantities are processed separately. In particular, the periodic incremental differential of cumulative flow is compressed from tens of thousands of values ​​to single-digit increments, reducing the number of bytes transmitted for cumulative flow from 4 bytes to 2 bytes. By decoupling timestamps and using Varint encoding, each 19-byte timestamp is compressed to an average of 1-2 bytes, achieving an overall compression rate of over 90% in batch processing scenarios. By establishing an independent verification dimension through the physical integral relationship between the cumulative flow increment and the instantaneous flow, it is possible not only to detect transmission errors, but also to discover hardware anomalies in water meter measurement. Based on the above optimizations, in a batch processing scenario with N=10, the total transmission volume of a single report is reduced from 1400~1600 bytes in the traditional JSON method to about 100 bytes, with a compression rate of over 90%. Detailed Implementation

[0019] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0020] The technical problem to be solved by this invention is to provide a method, terminal and system that can fully utilize the physical characteristics and time series features of ultrasonic water meter data to achieve extreme compression transmission, addressing the deficiency of insufficient compression rate in existing ultrasonic water meter data transmission.

[0021] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A method for efficient compression and transmission of ultrasonic water meter data includes the following steps: Step 1: Data Acquisition and Field Indexing. The ultrasonic water meter terminal collects and caches raw data records at fixed intervals. Each record includes at least the timestamp, instantaneous flow rate, cumulative flow rate, flow velocity, signal strength, and meter status fields. When the terminal is first started or a field change command is issued from the cloud, all field names are extracted and a unique field number is assigned to each field name to construct a Field Number Mapping Table (FIMT). The FIMT is encapsulated into a first compressed packet (FCP) and transmitted to the cloud server once via the control channel. The terminal and the cloud persistently store the FIMT, and it will not be transmitted again in subsequent data reports unless the field structure changes.

[0022] Step 2: Decoupling and Differential Encoding of Timestamp Periods. Extract the timestamp t1 of the first record from the N original data records in the current batch as the base timestamp T. base The timestamp is represented as an integer in Unix timestamp format and occupies 4 bytes. For the i-th subsequent record (i=2,3,...,N), the timestamp difference Δt is calculated. i =t i -T base Use variable-length integer encoding (Varint) for each Δt. i Encode: Translate Δt i The binary value is stored as a coding unit in the lower 7 bits of a byte, with the highest bit of the byte serving as a continuation flag. The highest bit of the last coding unit is 0, and the rest are 1.

[0023] Step 3: Numerical Content Matrixing and Two-Level Difference. Following the field sequence numbering defined in FIMT, arrange the numerical fields of the N records (after removing the timestamp field) into an N-row × (M-1)-column numerical matrix, where M is the total number of fields and M-1 is the total number of numerical fields. Define the first row of the matrix as the baseline data row (BR), where each field value is encoded with its original precision. Begin the two-level difference strategy from the second row onwards: First-level differential: For common analog quantity fields such as instantaneous flow rate, flow velocity, and signal strength, adjacent difference differential is used: the current row field value is subtracted from the corresponding field value of the previous row, and the difference is encoded using half-precision floating-point number (2 bytes) or signed integer (1 byte).

[0024] Second-level difference: For the cumulative flow field, periodic incremental difference is used: the cumulative flow value of the current row is subtracted from the cumulative flow value of the previous row, and the difference represents the increase in water flow volume between the current record and the previous record, using half-precision floating-point encoding.

[0025] The above encoded Δt i The differential values ​​of various conventional analog quantities, the cumulative flow increment values, and the instrument status enumeration codes are combined in a fixed order to form differential data rows (DRs). The instrument status enumeration codes map the status strings to 1-byte binary codes through a preset status enumeration dictionary (SED). The SED and FIMT are constructed synchronously and encapsulated together in FCP for transmission.

[0026] Step 4: Batch packaging and transmission. Transfer T... base The BR and all DRs are sequentially concatenated to generate a second compressed packet (SCP). The SCP message structure includes, in sequence: packet type identifier (1 byte), batch sequence number (1 byte), record quantity N (1 byte), T... base (4 bytes), BR (variable length), DR1 to DR (N-1)(Variable length). Transmit SCP to a cloud server via an NB-IoT network.

[0027] Step 5: Cloud Decompression and Data Restoration. After receiving the SCP, the cloud server parses the packet header to obtain the N value and reads the T value. base Then, convert the time to local time and parse the BR to reconstruct the first complete record based on FIMT. Then, parse each DR sequentially: obtain Δt through Varint decoding. i Restore the timestamp; sum each difference value with the corresponding field value in the previous row to restore the regular analog quantity field; sum the cumulative flow increment value with the cumulative flow value in the previous row to restore the cumulative flow; restore the enumeration code to the instrument status string through SED reverse lookup.

[0028] Furthermore, step 5 is followed by step 6, data consistency verification. The cloud uses the restored instantaneous traffic value and the time interval between adjacent records to calculate the expected cumulative traffic increment, and compares it with the restored actual cumulative traffic increment value. When the absolute value of the difference between the two exceeds a preset threshold, an anomaly is determined and an alarm is triggered.

[0029] This invention also provides a high-efficiency compressed transmission terminal for ultrasonic water meter data, comprising: a data acquisition module, a field index solidification module, a timestamp differential encoding module, a numerical matrix differential module, a batch packaging module, and a communication module. The functions of each module correspond to the steps in the above-described method.

[0030] The present invention also provides an efficient compression and transmission system for ultrasonic water meter data, including the aforementioned terminal and a cloud server. The cloud server includes a message receiving and parsing module and a data restoration module.

[0031] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments.

[0032] Example 1: In this example, the ultrasonic water meter terminal is deployed in a residential community, with a data collection period T. c =60 seconds, batch processing quantity N=10 records, that is, a batch report is performed every 10 minutes. The communication method is NB-IoT.

[0033] Step S1: Data Acquisition and Field Index Consolidation The terminal collected 10 raw data records. Taking the first and second records as examples: Record 1: {"time":"2026-06-12 10:00:00","flow_rate":2.50,"total_flow":54321.67,"velocity":0.85,"signal_strength":92,"status":"normal"}; Record 2: {"time":"2026-06-12 10:01:00","flow_rate":2.52,"total_flow":54321.71,"velocity":0.86,"signal_strength":92,"status":"normal"}; Upon initial startup, the terminal extracts a set of field names F = {time, flow_rate, total_flow, velocity, signal_strength, status}, with M=6. After removing the timestamp field, the data is sorted according to business priority, and the FIMT is constructed as shown in Table 1 below: Table 1: FIMT Table 0 flow_rate float32 4 1 total_flow float32 4 2 velocity float32 4 3 signal_strength uint8 1 4 status uint8 1 Simultaneously construct SED: {"normal":0x00, "alarm":0x01, "leak":0x02, "reverse":0x03, "error":0x04}; FIMT and SED are serialized into FCP, with a total length of approximately 52 bytes, and sent to the cloud in one go via the NB-IoT control channel.

[0034] Step S2: Periodic decoupling and interpolation encoding of timestamps The timestamps and their Unix timestamps for the 10 records are shown in Table 2 below: Table 2: Timestamp Record Table 1 2026-06-12 10:00:00 1780000000 2 2026-06-12 10:01:00 1780000060 3 2026-06-12 10:02:00 1780000120 4 2026-06-12 10:03:00 1780000180 5 2026-06-12 10:04:00 1780000240 6 2026-06-12 10:05:00 1780000300 7 2026-06-12 10:06:00 1780000360 8 2026-06-12 10:07:00 1780000420 9 2026-06-12 10:08:00 1780000480 10 2026-06-12 10:09:00 1780000540 T base = 1780000000, occupying 4 bytes.

[0035] Calculate Δt i : Δt2= 1780000060 - 1780000000 = 60 Δt3 = 1780000120 -1780000000 = 120 Δt4= 180 Δt5 = 240 Δt6 = 300 Δt7 = 360 Δt8 = 420 Δt9 =480 Δt 10 = 540; Varint encoding: The binary representation of 60 is 00111100, which is less than 128. After encoding, it becomes 0x3C (1 byte). The binary representation of 120 is 01111000, which is less than 128. After encoding, it becomes 0x78 (1 byte). The binary representation of 540 is 10 00011100, which requires 2 bytes: the lower 7 bits 0011100 plus the highest bit 1 equals 10011100 = 0x9C, the higher bits 00000100 plus the highest bit 0 equals 00000100 = 0x04, which is 0x9C 0x04 (2 bytes) after encoding. Each Δt i The Varint encoding results and the number of bytes occupied are shown in Table 3 below: Table 3: Varint Encoding Results and Byte Count Statistics 2 60 3C 1 3 120 78 1 4 180 B4 01 2 5 240 F0 01 2 6 300 AC 02 2 7 360 E8 02 2 8 420 A4 03 2 9 480 E0 03 2 10 540 9C 04 2 Total bytes for the timestamp portion = 4 (T) base ) + 1+1+2+2+2+2+2+2+2 = 20 bytes.

[0036] Comparison: 10 ISO 8601 timestamps require a total of 10 × 19 = 190 bytes, while this solution only requires 20 bytes, resulting in a compression rate of (190 - 20) / 190 = 89.5%.

[0037] Step S3: Numerical Content Matrixing and Two-Level Difference Construct the numerical matrix (in FIMT field order: flow_rate, total_flow, velocity, signal_strength, status_code) as shown in Table 4 below: Table 4: Statistical Table of Numerical Matrix 1(BR) 2.50 54321.67 0.85 92 0x00 2 2.52 54321.71 0.86 92 0x00 3 2.48 54321.74 0.84 91 0x00 4 2.51 54321.78 0.85 92 0x00 5 2.53 54321.82 0.86 92 0x00 6 2.49 54321.85 0.84 91 0x00 7 2.50 54321.89 0.85 92 0x00 8 2.52 54321.93 0.86 92 0x00 9 2.55 54321.98 0.87 93 0x00 10 2.50 54322.02 0.85 92 0x00 Baseline data row BR encoding (raw precision): flow_rate=2.50→float32 (4 bytes) total_flow=54321.67→float32 (4 bytes) velocity=0.85→float32 (4 bytes) signal_strength=92→uint8 (1 byte) status_code=0x00→uint8 (1 byte) Total BR bytes = 4+4+4+1+1 = 14 bytes.

[0038] Calculate the difference data rows DR2~DR 10 : Taking DR2 as an example: Δflow_rate2 = 2.52 - 2.50 = 0.02 → half-float (2 bytes), hexadecimal representation is approximately 0x0000 (approximate encoding of half precision 0.02); Δtotal_flow2 = 54321.71 - 54321.67 = 0.04 → half-float (2 bytes); Δvelocity2 = 0.86 - 0.85 = 0.01 → half-float (2 bytes); Δsignal_strength2 = 92 - 92 = 0 → int8 (1 byte), value is 0x00; status_code2= 0x00(normal); Δt2 encoding = 0x3C (1 byte) DR2 total bytes = 1 + 2 + 2 + 2 + 1 + 1 = 9 bytes; Taking DR3 as an example: Δflow_rate3 = 2.48 - 2.52 = -0.04 → half-float (2 bytes); Δtotal_flow3 = 54321.74 - 54321.71 = 0.03 → half-float (2 bytes); Δvelocity3 = 0.84 - 0.86 = -0.02 → half-float (2 bytes); Δsignal_strength3 = 91 - 92 = -1 → int8 (1 byte), value is 0xFF; status_code3 = 0x00; Δt3 encoding = 0x78 (1 byte) DR3 total bytes = 1 + 2 + 2 + 2 + 1 + 1 = 9 bytes; Similarly, calculate all DRs and summarize them in Table 5 below: Table 5: DR Statistics Table <![CDATA[DR2]]> 1 2 2 2 1 1 9 <![CDATA[DR3]]> 1 2 2 2 1 1 9 <![CDATA[DR4]]> 2 2 2 2 1 1 10 <![CDATA[DR5]]> 2 2 2 2 1 1 10 <![CDATA[DR6]]> 2 2 2 2 1 1 10 <![CDATA[DR7]]> 2 2 2 2 1 1 10 <![CDATA[DR8]]> 2 2 2 2 1 1 10 <![CDATA[DR9]]> 2 2 2 2 1 1 10 <![CDATA[DR 10 ]]> 2 2 2 2 1 1 10 The total number of bytes for 9 DRs is 9 + 9 + 10 + 10 + 10 + 10 + 10 + 10 + 10 = 88 bytes.

[0039] Step S4: Construct and transfer the SCP SCP message structure: Packet Header: 0x01 (1 byte, standard data packet); Sequence Num: 0x01 (1 byte, batch 1); Record Count: 0x0A (1 byte, 10 records); T base[0x6A, 0x1E, 0x4A, 0x80] (4 bytes, 1780000000 in big-endian representation); BR: 14 bytes; DR2~DR 10 The total length of the 88-byte SCP is 3 + 4 + 14 + 88 = 109 bytes.

[0040] Compared to the traditional JSON format where each JSON string is approximately 150 bytes, and 10 strings total 1500 bytes, the compression rate is (1500-109) / 1500 = 92.7%.

[0041] Step S5: Unzip and restore from the cloud Cloud-based resolution: Parse the header: 0x01 (standard data packet), 0x01 (batch 1), 0x0A (10 records); Read T base =1780000000, converted to local time 2026-06-12 10:00:00; Analyze the BR and restore record 1 using FIMT: flow_rate=2.50, total_flow=54321.67, velocity=0.85, signal_strength=92, status="normal"; Analysis of DR2: Reading Δt2 encoded as 0x3C, Varint decodes it to 60, so t2 = 1780000000 + 60 = 2026-06-12 10:01:00; flow_rate2= 2.50 + 0.02 = 2.52; total_flow2= 54321.67 + 0.04 = 54321.71; velocity2= 0.85 + 0.01 = 0.86; signal_strength2= 92 + 0 = 92; status_code2 = 0x00 → "normal"; Analysis of DR3: Reading Δt3 encoded as 0x78, Varint decodes it to 120, so t3 = 1780000000 + 120 = 2026-06-12 10:02:00; flow_rate3= 2.52 + (-0.04) = 2.48; total_flow3= 54321.71 + 0.03 = 54321.74; velocity3= 0.86 + (-0.02) = 0.84; signal_strength3= 92 + (-1) = 91; status_code3= 0x00 → "normal"; Repeat steps 4 and 5 until all 10 records are restored. The restored value of each record is completely consistent with the original value at the time of acquisition, verifying the lossless nature of the compression-transmission-decompression process.

[0042] Step S6: Data Consistency Verification Let's take record 2 as an example for verification: Time interval: Δt2 = 60 seconds = 1 / 60 hour; Expected increment = flow_rate2 × Δt2 = 2.52 m³ / h × (1 / 60)h = 0.042 m³; Actual increment = Δtotal_flow2 = 0.04 m³; Difference = |0.04 - 0.042| = 0.002 m³; Assuming the preset threshold THRESHOLD = 0.005 m³, 0.002 < 0.005, the verification passes.

[0043] The verification results for all 10 records in the batch are shown in Table 6 below: Table 6: Verification Results Table 1(BR) 2.50 — — — — — 2 2.52 60 0.042 0.04 0.002 pass 3 2.48 60 0.041 0.03 0.011 pass 4 2.51 60 0.042 0.04 0.002 pass 5 2.53 60 0.042 0.04 0.002 pass 6 2.49 60 0.042 0.03 0.012 pass 7 2.50 60 0.042 0.04 0.002 pass 8 2.52 60 0.042 0.04 0.002 pass 9 2.55 60 0.043 0.05 0.007 pass 10 2.50 60 0.042 0.04 0.002 pass Analysis: The verification difference of all 10 records is less than the threshold of 0.005 m³, indicating that the water meter is in normal metering status and no bit errors occurred during data transmission.

[0044] It is worth noting that the differences between records 3 and 6 are relatively large (0.011 and 0.012), but they still passed the verification. These differences reflect the inherent metering error between the two independent sensor channels for instantaneous flow and cumulative flow, which is within the normal fluctuation range. If the difference of any record suddenly increases to more than 0.05 m³, it may indicate a sensor malfunction or transmission error, and the system will trigger an alarm.

[0045] To verify the beneficial effects of the present invention, the following experiments were conducted: Experimental objective: To verify the advantages of the present invention (hereinafter referred to as "the present invention") over traditional JSON transmission methods and fixed-length binary concatenation methods in terms of compression ratio, transmission efficiency, and decompression accuracy.

[0046] Test conditions: Data source: Data collected continuously for 24 hours from a deployed ultrasonic water meter terminal; Data collection period: 60 seconds; Batch size: N=10; NB-IoT simulated network environment: uplink bandwidth 20kbps, single packet payload limit 256 bytes; Dataset size: Four representative test periods (different water usage patterns) were selected, with each group containing 200 original data records; The experimental groups and control groups are shown in Table 7: Table 7: Statistical Table of Experiment Subjects A Traditional JSON + Base64 Each record is JSON serialized, Base64 encoded, and transmitted via TCP. B Fixed-length binary concatenation Each record is transmitted as a binary stream concatenated with fixed field lengths. C Invention Solution Batch compression transmission is performed using the FIMT+differential+Varint scheme of this invention. Evaluation indicators: Average number of bytes transmitted per record: Total number of bytes transmitted / Total number of records; Compression ratio: The compression ratio relative to group A (JSON baseline); Success probability of a single report: Under the condition that the maximum payload of a single NB-IoT message is 256 bytes, can a single report (10 records) be completed within one transmission opportunity; Data restoration accuracy: The percentage of decompressed data that is completely identical to the original data; Battery life improvement factor: Estimated based on a transmission power consumption model; Experimental Data and Analysis Test dataset description Two hundred records were selected from each of four typical water usage periods, as shown in Table 8 below: Table 8: Statistical Record Table D1 Low point in the early morning (00:00~03:20) Traffic is close to zero, with minimal fluctuations. 0~0.5 m³ D2 Morning rush hour (06:00~09:20) Large and frequent traffic fluctuations 0.5~8.0 m³ D3 Stable during the day (10:00~13:20) Traffic volume is moderate with mild fluctuations. 0.2~3.0 m³ D4 Abnormalities at night (21:00~00:20) Minor leakage exists (continuous low flow rate 0.05). 0~1.0 m³ Experimental results: 1. Comparison of average bytes transmitted per message, see Table 9: Table 9: Comparison of Results (I) D1 148.3 18.0 8.2 D2 152.7 18.0 11.6 D3 150.1 18.0 10.1 D4 149.8 18.0 9.5 average 150.2 18.0 9.9 analyze: JSON format: approximately 150 bytes per string, subject to slight fluctuations in the number of digits. Binary concatenation: fixed at 18 bytes / segment (time 4 + instantaneous 4 + cumulative 4 + flow rate 4 + signal 1 + state 1 = 18). This invention: averages 9.9 bytes per message, only 6.6% of JSON and 55% of binary concatenation; D1 (off-peak hours) compression is the most effective (8.2 bytes / segment) because the difference values ​​are generally smaller or even zero, and zero values ​​are skipped for further compression. The compression effect of D2 (peak hours) is relatively weak (11.6 bytes / file) because the large range of differential values ​​is caused by the drastic fluctuations in traffic. 2. Comparison of compression ratios (with group A as the baseline), see Table 10: Table 10: Comparison of Results (II) D1 — 87.9% 94.5% D2 — 88.2% 92.4% D3 — 88.0% 93.3% D4 — 88.0% 93.7% average — 88.0% 93.4% Analysis: This invention achieves an 88% compression rate based on binary concatenation; 3. Success rate of a single report (NB-IoT single message payload limit 256 bytes) Each group of 200 records was divided into 20 batches (10 records per batch). The size of the message generated in each batch and whether it could be completed within a single transmission opportunity were recorded, as shown in Table 11. Table 11: Record Statistical Record Table D1 The average batch size is 1483 bytes, and 0% of batches can be completed within 256 bytes. A single batch is 180 bytes; 100% of batches can be completed within 256 bytes. A single batch is 82 bytes; 100% of batches can be completed within 256 bytes. D2 The average batch size is 1527 bytes, and 0% of batches can be completed within 256 bytes. A single batch is 180 bytes; 100% of batches can be completed within 256 bytes. A single batch is 116 bytes; 100% of batches can be completed within 256 bytes. D3 The average batch size is 1501 bytes, and 0% of batches can be completed within 256 bytes. A single batch is 180 bytes; 100% of batches can be completed within 256 bytes. A single batch is 101 bytes; 100% of batches can be completed within 256 bytes. D4 The average batch size is 1498 bytes, and 0% of batches can be completed within 256 bytes. A single batch is 180 bytes; 100% of batches can be completed within 256 bytes. A single batch is 95 bytes; 100% of batches can be completed within 256 bytes. analyze: JSON method: The size of a single batch of messages far exceeds 256 bytes, so it must be transmitted in multiple packets. In the weak signal environment of NB-IoT, the cumulative failure rate of multiple transmissions is extremely high. Binary splicing: 180 bytes / batch, which can be completed in a single transmission, but it is close to the 256-byte limit and there is still a risk of failure when the signal is weak; This invention: The number of single-batch messages in all datasets does not exceed 120 bytes, which is far below the 256-byte limit, leaving sufficient redundancy space for error correction coding and retransmission protocol overhead, resulting in the highest transmission reliability; 4. Data restoration accuracy The original records from four datasets, totaling 800 records, were compressed, transmitted, and restored. Field-by-field comparisons were performed, and the results are shown in Table 12. Table 12: Comparison Table Total number of test records 800 800 800 Completely restore consistent numbers 800 800 800 accuracy 100% 100% 100% Analysis: All three schemes can achieve 100% restoration accuracy under error-free transmission conditions, proving that the compression-restoration process of this invention is lossless compression.

[0047] 5. Estimation of the increase in battery life The power consumption model is used for estimation based on a typical NB-IoT terminal. The power consumption model parameters are shown in Table 13 below: Table 13: Power Consumption Model Parameter Table <![CDATA[Standby power consumption P idle > 15 μA The terminal is in a light sleep state. <![CDATA[Transmit power P tx > 200 mA NB-IoT module transmit status (23dBm) Sending time T_tx_per_byte 0.8 ms / byte NB-IoT uplink speed is approximately 20kbps <![CDATA[Receiver power consumption P rx > 60 mA NB-IoT module reception status Receive time T_rx_per_packet 500 ms ACK waiting time after each report <![CDATA[Battery capacity C battery > 8500 mAh Typical lithium-ion battery (ER18505) Taking dataset D1 (off-peak hours) as an example, the number of reports per day = 24 × 60 = 1440 (reporting per minute, in batches of 10, i.e., one batch report every 10 minutes, for a total of 144 batch reports per day): Group A (JSON format): Single batch reporting transmission bytes: 1483 bytes; Single transmission time: 1483 × 0.8 ms = 1186.4 ms; Energy consumption per transmission: 1186.4ms × 200mA = 237.28 mAs; Since packets exceeding 256 bytes need to be segmented, assuming it needs to be transmitted in 6 parts, an ACK needs to be received after each transmission. Total energy consumption for a single report = (237.28 + 6 × 500ms × 60mA) / 3600 ≈ 0.116 mAh; Daily reported energy consumption = 144 × 0.116 = 16.70 mAh; Standby power consumption = 24h × 15μA = 0.36 mAh; Total daily energy consumption = 17.06 mAh; Theoretical range = 8500 / 17.06 ≈ 98 days ≈ 1.36 years; Group B (binary concatenation method): Single batch reporting transmission bytes: 180 bytes; Single transmission time: 180 × 0.8 ms = 144 ms; Energy consumption per transmission: 144ms × 200mA = 28.8 mAs; It can be completed in one transmission, and the total power consumption for a single report is (28.8 + 500ms × 60mA) / 3600 = 0.0163 mAh; Daily reported energy consumption = 144 × 0.0163 = 2.35 mAh; Standby power consumption = 0.36 mAh; Total daily energy consumption = 2.71 mAh; Theoretical range = 8500 / 2.71 ≈ 3137 days ≈ 8.59 years; Group C (Solution of the present invention): Single batch reporting transmission bytes: 82 bytes; Single transmission time: 82 × 0.8 ms = 65.6 ms; Energy consumption per transmission: 65.6ms × 200mA = 13.12 mAs; It can be completed in one transmission, and the total power consumption for a single report is (13.12 + 500ms × 60mA) / 3600 = 0.0120 mAh; Daily reported energy consumption = 144 × 0.0120 = 1.73 mAh; Standby power consumption = 0.36 mAh; Total daily energy consumption = 2.09 mAh; Theoretical range = 8500 / 2.09 ≈ 4067 days ≈ 11.14 years; A summary of battery life comparisons is shown in Table 14: Table 14: Summary Table of Battery Life Comparison Group A (JSON) 17.06 498 1.36 1.0x (baseline) Group B (binary) 2.71 3137 8.59 6.3x Group C (This invention) 2.09 4067 11.14 8.2x analyze: Compared to the JSON method, the solution of this invention increases battery life from 1.36 years to 11.14 years, an improvement of approximately 8.2 times; Compared to the binary splicing method, the solution of this invention further increases the battery life from 8.59 years to 11.14 years, an improvement of approximately 30%. This means that after adopting the solution of this invention, the ultrasonic water meter terminal can be used without replacing the battery throughout its entire design life (usually 10 to 12 years), which greatly reduces the operation and maintenance costs. Based on the complete experimental verification above, the following conclusions can be drawn: 1. Compression efficiency: The average number of bytes transmitted per message in this invention is 9.9 bytes, significantly lower than 150.2 bytes for JSON and 18.0 bytes for binary concatenation. The compression rate reaches 93.4% compared to JSON, and even with the already compact binary concatenation method, it still achieves a further compression of 45%.

[0048] 2. In terms of transmission reliability: The single batch message size of the present invention is between 82 and 116 bytes, which is far lower than the 256-byte single message payload limit of the NB-IoT network. All data can be reported within a single transmission opportunity, avoiding the cumulative failure risk caused by packet splitting.

[0049] 3. Regarding data integrity: The compression-decompression process of this invention is completely lossless, and the restoration accuracy of 800 test records reaches 100%, verifying the engineering feasibility of the technical solution.

[0050] 4. Improved battery life: The solution of this invention increases the theoretical battery life of the ultrasonic water meter terminal from 1.36 years in the JSON format to 11.14 years, meeting the design requirement of no battery replacement throughout the entire life cycle of the water meter, and has significant economic benefits and engineering application value.

[0051] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for efficient compression and transmission of ultrasonic water meter data, characterized in that, Includes the following steps: Step 1: Collect multiple raw data records from the ultrasonic water meter terminal. Each raw data record includes at least the timestamp, instantaneous flow rate, cumulative flow rate, flow velocity, signal strength, and meter status fields. Extract all field names and assign unique field numbers to them. Construct a field number mapping table and encapsulate the field number mapping table into a first compressed package. Transmit the package to the cloud server via the control channel and store it persistently. Step 2: Extract the timestamp of the first record from the N original data records in the current batch as the base timestamp. The timestamp of the i-th record Calculate the difference Where i = 2, 3, ..., N, and variable-length integer encoding is used for each Encode; Step 3: Arrange the numerical fields of the N original data records after removing the timestamps into a numerical matrix of N rows × (M-1) columns according to the field number sequence defined in the field number mapping table, where M is the total number of fields and M-1 is the total number of numerical fields. The first row of the numerical matrix is ​​defined as the reference data row, and the values ​​of each field in the reference data row are encoded with the original precision. Starting from the second row of the numerical matrix, adjacent difference differentials are performed on the conventional analog quantity fields to generate the difference values ​​for each conventional analog quantity field, and periodic increment differentials are performed on the cumulative flow field to generate the cumulative flow increment value; the... The encoding, each of the differential values, the cumulative flow increment value, and the instrument status enumeration encoding are combined into differential data rows in a fixed order; The conventional analog quantity fields include instantaneous flow rate, flow velocity, and signal strength. The adjacent difference calculation method is as follows: the value of the conventional analog quantity field in the current row is subtracted from the value of the corresponding field in the previous row, and the resulting difference is encoded using a half-precision floating-point number or a signed integer. Step 4: Set the reference timestamp The reference data row and all the differential data rows are concatenated in sequence to generate a second compressed package, which is then transmitted to the cloud server via the NB-IoT network. Step 5: After receiving the second compressed package, the cloud server parses the second compressed package to obtain the reference timestamp. The baseline data row and each of the differential data rows, combined with the locally stored field number mapping table and status enumeration dictionary, are used to restore the complete original data record through incremental accumulation inverse operation.

2. The method for efficient compression and transmission of ultrasonic water meter data according to claim 1, characterized in that, The periodic increment difference calculation method for the cumulative flow field in step 3 is as follows: the cumulative flow value of the current row is subtracted from the cumulative flow value of the previous row, and the difference is encoded using a half-precision floating-point number; the physical meaning of the cumulative flow increment value is the increase in water flow volume within the time interval between the current record and the previous record.

3. The method for efficient compression and transmission of ultrasonic water meter data according to claim 2, characterized in that, The specific method of variable-length integer encoding in step 2 is as follows: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Each 7 bits of the binary value is used as a coding unit. Each coding unit is stored in the lower 7 bits of a byte. The highest bit of the byte is used as a continuation flag. When the byte is the last coding unit, the continuation flag is 0, otherwise the continuation flag is 1.

4. The method for efficient compression and transmission of ultrasonic water meter data according to claim 3, characterized in that, In step 3, the instrument status enumeration encoding maps the instrument status string to a fixed-length binary code through the status enumeration dictionary. The construction of the status enumeration dictionary and the construction of the field number mapping table are carried out simultaneously and are encapsulated together in the first compressed package for transmission.

5. The method for efficient compression and transmission of ultrasonic water meter data according to claim 4, characterized in that, In step 4, the message structure of the second compressed package, in byte stream order, includes: a package type identifier field, a batch sequence number field, a record quantity field N, and a base timestamp field. The system consists of a baseline data row field and N-1 sequentially arranged differential data row fields; wherein the package type identifier field, batch sequence number field, and record quantity field each occupy 1 byte, and the baseline timestamp... The field occupies 4 bytes.

6. The method for efficient compression and transmission of ultrasonic water meter data according to claim 5, characterized in that, The incremental accumulation inverse operation in step 5 includes: based on the reference timestamp and each of the above Restore the timestamp, add the difference value of the regular analog quantity field in the previous row to restore the regular analog quantity field value in the current row, add the cumulative flow value in the previous row to the cumulative flow increment value in the current row to restore the cumulative flow value in the current row, and restore the enumeration code to the instrument status string according to the status enumeration dictionary.

7. The method for efficient compression and transmission of ultrasonic water meter data according to claim 6, characterized in that, Step 5 is followed by step 6: The cloud server uses the restored instantaneous traffic value and the time interval of each record to calculate the expected cumulative traffic increment, compares the expected cumulative traffic increment with the restored cumulative traffic increment value, and when the absolute value of the difference between the two exceeds a preset threshold, it determines that the data record is abnormal and triggers an alarm.

8. A high-efficiency compressed transmission terminal for ultrasonic water meter data, characterized in that, include: The data acquisition module is used to collect and cache the raw data records of the ultrasonic water meter at fixed intervals. Each raw data record includes at least the timestamp, instantaneous flow rate, cumulative flow rate, flow velocity, signal strength, and instrument status fields. The field index solidification module is used to extract all field names and assign unique field numbers, construct a field number mapping table, and encapsulate the field number mapping table into a first compressed package and send it through the communication module. The timestamp differential encoding module is used to extract the base timestamp from N raw data records in the current batch. Calculate the difference between the timestamps of the subsequent N-1 records. And it is encoded using variable-length integer encoding; The numerical matrix differencing module is used to arrange the timestamp-extracted numerical fields into a numerical matrix according to the field sequence number defined in the field number mapping table. The first row of the numerical matrix is ​​used as the base data row and encoded with the original precision. Starting from the second row, adjacent difference differencing is performed on the conventional analog quantity fields, and periodic incremental differencing is performed on the cumulative flow field. The encoding, each differential value, and the enumerated encoding of the instrument status are combined into differential data rows; The conventional analog quantity fields include instantaneous flow rate, flow velocity, and signal strength. The adjacent difference calculation method is as follows: the value of the conventional analog quantity field in the current row is subtracted from the value of the corresponding field in the previous row, and the resulting difference is encoded using a half-precision floating-point number or a signed integer. The batch packaging module is used to package the base timestamp. The baseline data row and all the differential data rows are sequentially concatenated into a second compressed package; A communication module is used to send the first compressed package and the second compressed package via an NB-IoT network.

9. A high-efficiency compressed transmission system for ultrasonic water meter data, characterized in that, Including the terminal as described in claim 8 and the cloud server, wherein the cloud server includes: The message receiving and parsing module is used to receive the second compressed packet and parse out the reference timestamp. The baseline data row and each of the differential data rows; The data restoration module is used to restore the complete original data record by incremental accumulation inverse operation based on the field number mapping table and status enumeration dictionary stored locally.

Citation Information

Patent Citations

  • Meter reading data compression method, data format, equipment and storage medium

    CN112688692A

  • Data compression storage method of Internet of Things ultrasonic water meter

    CN118764033A