A method for collecting and reporting data from multiple monitoring points of a gateway

Through the design of its own protocol coding and the use of general modules for batch data, it solves the problems of high development cost and network load when batch reporting of data from multiple monitoring points on the Internet of Things platform, achieving the effect of simplifying development and reducing network costs.

CN114143374BActive Publication Date: 2024-09-27CHINA BASE DIGITAL INTELLIGENCE (CHONGQING) TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202111430364.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2024-09-27
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

When existing IoT platforms report data from multiple monitoring points in batches, hardware developers need to define specific structural models and perform hardware upgrades, resulting in high development costs, complex business analysis at the SaaS layer, and coupling problems.

Method used

Optimize the gateway data model through its own protocol coding design, use batch data common modules for coding aggregation, and report batch aggregation data to the platform, simplifying gateway development and use, and reducing gateway network load.

Benefits of technology

It simplifies the development and use of gateways, reduces gateway network load and network transmission traffic, saves network costs, and optimizes the analysis and processing of data by SaaS layer services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114143374B
    Figure CN114143374B
Patent Text Reader

Abstract

The present invention discloses a method for aggregating and reporting data from multiple monitoring points of a collection gateway, and relates to the technical field of data monitoring. The present invention comprises the following steps: a hardware developer defines a monitoring point device model on a platform according to monitoring device data, and defines data coding and data transmission channels; a proxy relationship between a gateway and a sub-device is established on the platform; a hardware developer integrates and develops batch data aggregation and reporting capabilities for a collection gateway; the gateway layer collects monitoring point device data, and encodes and aggregates the data using a general module for batch data, and reports batch aggregated data to the platform. The present invention optimizes the data model collected and transmitted to the platform by the gateway through a proprietary protocol coding design, integrates and develops batch data aggregation and reporting capabilities for a collection gateway, and reports batch aggregated data to the platform after coding and aggregation, thereby simplifying the development and use of the gateway, reducing the network load capacity of the gateway, and saving network costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of data monitoring, and in particular relates to a method for collecting gateway multi-monitoring point data aggregation and reporting. Background Art

[0002] With the continuous evolution of the agricultural Internet of Things platform, various types of agricultural scenarios have rich data monitoring indicators. Major Internet of Things basic platform providers have begun to formulate device access platform standards. At present, the standard protocol for connecting IoT devices to IoT platforms is the MQTT protocol, which also includes COAP, HTTP and other protocols. The edge side uses LORA, WIFI, Bluetooth and other networking to realize the gateway agent multi-monitoring point data collection. The collection gateway can report the monitoring point data in real time to ensure the real-time nature of the data. When the data communication volume of the gateway layer agent monitoring point is too large, multiple collected data have to be aggregated and reported in batches. Aggregate reporting reduces the interaction with the server network, reduces the gateway network load, and improves the gateway capability.

[0003] The existing platform batch data point development process is as follows Figure 2 As shown in the figure, all major IoT platforms use MQTT as the standard IoT communication protocol. The monitoring point data model is defined through the data model. The batch aggregation reporting capability is supported through the structure data model. Multiple monitoring point data are defined in the structure, and there is no special support for batch data reporting. In order for the gateway to support batch reporting of multiple monitoring point data, hardware developers usually need to define specific structure models and develop different data assembly solutions for different scenarios. In addition, hardware developers need to make corresponding hardware upgrades for each model change, which greatly increases the cost of hardware development. It also brings many problems to the SaaS layer business development, which requires parsing specific structure data before doing data analysis. To a certain extent, it makes the hardware and SaaS layer developers coupled. Summary of the invention

[0004] The purpose of the present invention is to provide a method for aggregating and reporting data from multiple monitoring points of a collection gateway. The method optimizes the data model of the gateway data collection and transmission to the platform through its own protocol coding design, integrates the development of batch data aggregation and reporting capabilities of the collection gateway, encodes and aggregates the data using a batch data general module, and reports the batch aggregated data to the platform, thereby solving the problems of low efficiency in existing gateway development and use and low gateway load capacity.

[0005] To solve the above technical problems, the present invention is achieved through the following technical solutions:

[0006] The present invention is a method for collecting and reporting data from multiple monitoring points of a gateway, comprising the following steps:

[0007] Step S1: The hardware developer defines the monitoring point device model on the platform according to the monitoring device data, and defines the data encoding and data transmission channel;

[0008] Step S2: Establishing a proxy relationship between the gateway and the sub-device on the platform according to the relationship between the real acquisition gateway and the real proxy device, ensuring that the platform layer can verify the proxy relationship;

[0009] Step S3: The hardware developer integrates and develops batch data aggregation and reporting capabilities for the acquisition gateway;

[0010] Step S4: The gateway layer collects the monitoring point equipment data and encodes and aggregates the data using the batch data general module;

[0011] Step S5: The collection gateway reports batch aggregated data to the platform using the MQTT protocol;

[0012] Step S6: The platform receives and processes the data;

[0013] Step S7: The SaaS platform developer receives the monitoring point data.

[0014] As a preferred technical solution, in step S3, batch data aggregation requires the design of a general batch data model, and the data model contains the minimum required data; the data model includes business data timestamp, own data, proxy sub-device data, data stream channel name, data encoding type and data point.

[0015] As a preferred technical solution, in step S4, the batch data general module designs the batch data model using byte encoding.

[0016] As a preferred technical solution, in step S5, batch aggregated data is sent to the platform in the form of a message; the message is provided with three types of data: a control byte, a data description byte and a data byte; the control byte is used to describe the model characteristics through bits; the data description byte is used to describe the data length; the data byte is used to encode the data into a corresponding byte array and combine the byte arrays in the order of the data model to obtain optimized encoded transmission data.

[0017] As a preferred technical solution, the message includes an overall header, its own data stream and a proxy device data stream; the overall header includes a first byte representing a version number, a second byte representing an overall control byte and 8 bytes of optional bytes; the own data stream, the first byte represents the proxy's own data volume N, and the rest represent N single data stream data; the proxy device data stream, the first byte represents the proxy device data volume M, and the rest represent M proxy device data.

[0018] As a preferred technical solution, the second byte of the overall header needs to determine whether the first bit identifies whether a global business timestamp exists. When the bit value is 1, the business timestamp data needs to be read; the second bit identifies whether its own data stream data exists. When the bit value is 1, the own data stream data needs to be read; the third bit identifies whether proxy data stream data exists. When the bit value is 1, the proxy device data stream data needs to be read, and the remaining five bits are reserved bits.

[0019] As a preferred technical solution, the first byte of the proxy device data represents the device SN length Y3, the subsequent Y3 bytes are the device SN data, and then the subsequent 1-2 bytes represent the single data stream data volume X, followed by X single data stream data.

[0020] As a preferred technical solution, the first byte of the single data stream data is a control byte, and the first bit is used to identify whether a local service timestamp exists; when the bit is 1, the next 8 bytes are local data stream service timestamp data; the next three bits are reserved bits, and the last four bits indicate the encoding type of the data; followed by 8 bytes of local data stream service timestamp data (optional); followed by a byte indicating the length of the data stream name Y1, followed by Y1 bytes of the data stream name; followed by 1-3 bytes of variable-length integer data, indicating the length of the real data Y2, followed by Y2 bytes of the real data.

[0021] As a preferred technical solution, in step S5, when designing the data model for the data acquisition and transmission from the gateway to the platform using its own protocol encoding, it is necessary to encode and decode the pseudocode; wherein, the encoding process of the pseudocode is as follows:

[0022] Step T1: Encode the version number into one byte B1;

[0023] Step T2: The overall control byte B2 is obtained according to whether the global BizTime (business timestamp) exists, whether the own data exists, and whether the proxy data exists. If BizTime exists, the timestamp data is encoded into an 8-byte array B3, and the overall header encoding is completed;

[0024] Step T3: If the self data exists, encode the self data and go to step T4, otherwise go to step T5;

[0025] Step T4: First, variable-length integer encoding B4 is performed on the length of the data array L1; then the data is encoded, firstly, the control byte B5 of a single data stream is encoded according to whether BizTime exists in the current data and the data encoding type. If BizTime exists, the timestamp data is encoded into an 8-word array B6; then the data stream name is encoded in utf-8 to obtain a byte array B7, and then the length of B7 is encoded to obtain a byte B8; then the real data is encoded according to the encoding type to obtain byte data B9, and then the length of B9 is variable-length integer encoded to obtain a byte array B10; the encoding of the data itself is completed by looping L1 times, and then the process goes to step T5;

[0026] Step T5: If the proxy data exists, encode the proxy data and proceed to step T6; otherwise proceed to step T7;

[0027] Step T6: First, perform variable-length integer encoding on the proxy device data length L2 to obtain a byte array B11; then perform utf-8 encoding on the proxy device SN to obtain a byte array B12, and then encode the length of B12 to obtain a byte B13; then perform variable-length integer encoding on the proxy data length L3 to obtain a byte array B14; then encode the data, firstly encode the control byte B15 of a single data stream according to whether BizTime exists in the current data and the data encoding type, if BizTime exists, encode the timestamp data into an 8-word array B16; then perform utf-8 encoding on the data stream name to obtain a byte array B17, and then encode the length of B17 to obtain a byte B18; then encode the real data according to the encoding type to obtain byte data B19, and then perform variable-length integer encoding on the length of B19 to obtain a byte array B20; loop L3 times to complete the encoding of the current device data; loop L2 times to complete the encoding of the proxy device data; otherwise, proceed to step T7;

[0028] Step T7: Assemble the data in the encoding process into a binary array; the structure is: B1+B2[+B3][+B4+B5[+B6]+B8+B7++B10+B9]{L1}[+B11(+B13+B12+B14+B15[+B16]+B18+B17++B20+B19]){L3}]{12};

[0029] In the formula, {n} means that the previous expression is repeated n times, [] means that the expression is optional, and () means that the expression must exist.

[0030] As a preferred technical solution, the decoding process of the pseudocode is as follows:

[0031] Step J1: read the first byte to represent the version number, and read the second byte to represent the control byte;

[0032] Step J2: If the first bit of the control byte read in the first step is 1, the next 8 bytes read are global service timestamp data, otherwise proceed directly to step J3;

[0033] Step J3: If the second bit of the control byte read in the first step is 1, proceed to step J4, otherwise skip step J4;

[0034] Step J4: read the own data stream, read the variable-length integer representing the amount of data N of the agent itself; then loop N times to read the single data stream data, then proceed to step J5, until the reading of N data stream data is completed, and the reading of the own data is completed, then proceed to step J6;

[0035] Step J5: Reading a single data stream: The first step is to read the first byte to represent the control byte, and read the four bits after the first byte to represent the data encoding type. If the first bit of the first byte is 1, then read the subsequent eight bytes to represent the local business timestamp BizTime; then read a byte to represent the data stream name length Y1, and then read Y1 bytes to represent the data stream name; then read the variable-length positive number [1] Y2, and then read Y2 bytes to represent the real data, completing the reading of a data stream;

[0036] Step J6: If the third bit of the control byte read in the first step is 1, then read and proceed to step J7, otherwise the reading is completed;

[0037] Step J7: Read the proxy device data stream, read the variable-length integer data to obtain the proxy device data volume M; then loop M times to read the proxy device data stream data, and then proceed to step J8 until M proxy device data streams are read and decoding is completed;

[0038] Step J8: Read the proxy device data stream data, read the variable-length integer data to obtain the proxy device SN length Y3, and then read Y3 bytes to represent the proxy device SN; then read a byte to represent the proxy device data volume X, and then loop X times to read a single data stream data, and then proceed to step J5 until the reading of X data stream data is completed.

[0039] The present invention has the following beneficial effects:

[0040] The present invention optimizes the data model of the gateway data collection and transmission to the platform through its own protocol coding design, integrates the development of batch data aggregation and reporting capabilities of the collection gateway, encodes and aggregates the data using a batch data general module, and reports the batch aggregated data to the platform. This can simply and efficiently simplify the development and use of the gateway, effectively reduce the network load capacity of the gateway, and greatly optimize the network transmission traffic through data coding, saving network costs. The platform verifies and distributes the data, and ensures and optimizes the analysis and processing of data by SaaS layer services.

[0041] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0043] Figure 1 A method for collecting and reporting data from multiple monitoring points of a gateway according to the present invention;

[0044] Figure 2 Develop process timing diagrams for existing platform batch data points;

[0045] Figure 3 Design graphs for batch data models;

[0046] Figure 4 Pseudocode flow chart for encoding;

[0047] Figure 5 Pseudocode flowchart for decoding. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] See also Figure 1 As shown, the present invention is a method for collecting and reporting data from multiple monitoring points of a gateway, comprising the following steps:

[0050] Step S1: The hardware developer defines the monitoring point device model on the platform according to the monitoring device data, and defines the data encoding and data transmission channel;

[0051] Step S2: Establishing a proxy relationship between the gateway and the sub-device on the platform according to the relationship between the real acquisition gateway and the real proxy device, ensuring that the platform layer can verify the proxy relationship;

[0052] Step S3: The hardware developer integrates and develops the batch data aggregation and reporting capabilities of the acquisition gateway, supports batch data models and custom data encoding for batch data general module integration according to the protocol layer data channel specifications;

[0053] Step S4: The gateway layer collects the monitoring point equipment data and encodes and aggregates the data using the batch data general module;

[0054] Step S5: The collection gateway reports batch aggregated data to the platform using the MQTT protocol;

[0055] Step S6: The platform receives and processes the data; first, the data is parsed into a batch model; second, the agent's device is verified to see if there is an agent relationship with the platform; third, the uploaded data is model verified; fourth, the data is distributed to the monitoring points of the corresponding monitoring equipment;

[0056] Step S7: The SaaS platform developer receives the monitoring point data. At this time, the data of each monitoring point has been separated. The developer can selectively develop and analyze the monitoring point data and provide feedback for scenario management.

[0057] Among them, in step S3, batch data aggregation requires the design of a general batch data model, and the data model contains the minimum required data; the data model includes business data timestamp, own data, proxy sub-device data, data flow channel name, data encoding type and data point.

[0058] Among them, in step S4, the batch data general module designs the batch data model using byte encoding.

[0059] Among them, in step S5, batch aggregated data is sent to the platform in the form of a message; the message is set with three types of data: a control byte, a data description byte and a data byte; the control byte is used to describe the model characteristics through bits; the data description byte is used to describe the data length; the data byte is used to encode the data into the corresponding byte array and combine the byte arrays in the order of the data model to obtain the optimized encoded transmission data.

[0060] The message includes an overall header, its own data stream and a proxy device data stream; the overall header includes the first byte indicating the version number, the second byte indicating the overall control byte and 8 bytes of optional bytes; for its own data stream, the first byte indicates the amount of proxy data N, and the rest indicates N individual data stream data; for the proxy device data stream, the first byte indicates the amount of proxy device data M, and the rest indicates M proxy device data.

[0061] Among them, the second byte of the overall header needs to determine whether the first bit indicates whether there is a global business timestamp. When the bit value is 1, the business time data needs to be read; the second bit indicates whether there is its own data stream data; when the bit value is 1, it is necessary to read its own data stream data; the third bit indicates whether there is proxy data stream data. When the bit value is 1, it is necessary to read the proxy device data stream data. The remaining five bits are reserved bits.

[0062] Among them, the first byte of the proxy device data represents the device SN length Y3, the subsequent Y3 bytes are the device SN data, and then the subsequent 1-2 bytes represent the data volume of a single data stream X, followed by X single data stream data.

[0063] Among them, the first byte of a single data stream data is the control byte, and the first bit is used to identify whether there is a local business timestamp; when the bit is 1, the next 8 bytes are the local data stream business timestamp data; the next three bits are reserved bits, and the last four bits indicate the data encoding type, followed by 8 bytes of local data stream business timestamp data, followed by a byte indicating the data stream name length Y1, followed by Y1 bytes of the data stream name; followed by 1-3 bytes of variable-length integer data, indicating the length of the real data Y2, followed by Y2 bytes of the real data.

[0064] Among them, in step S5, when designing the data model for the data collection and transmission from the gateway to the platform through the own protocol coding, it is necessary to encode and decode the pseudocode; wherein, the encoding process of the pseudocode is as follows:

[0065] Step T1: Encode the version number into one byte B1;

[0066] Step T2: Encode the overall control byte B2 according to whether there is a global BizTime, whether there is self-data, and whether there is proxy data. If BizTime exists, encode the timestamp data into an 8-byte array B3, and the overall header encoding is completed;

[0067] Step T3: If the self data exists, encode the self data and go to step T4, otherwise go to step T5;

[0068] Step T4: First, variable-length integer encoding B4 is performed on the length of the data array L1; then the data is encoded, firstly, the control byte B5 of a single data stream is encoded according to whether BizTime exists in the current data and the data encoding type. If BizTime exists, the timestamp data is encoded into an 8-word array B6; then the data stream name is encoded in utf-8 to obtain a byte array B7, and then the length of B7 is encoded to obtain a byte B8; then the real data is encoded according to the encoding type to obtain byte data B9, and then the length of B9 is variable-length integer encoded to obtain a byte array B10; the encoding of the data itself is completed by looping L1 times, and then the process goes to step T5;

[0069] Step T5: If the proxy data exists, encode the proxy data and proceed to step T6; otherwise proceed to step T7;

[0070] Step T6: First, perform variable-length integer encoding on the proxy device data length L2 to obtain a byte array B11; then perform utf-8 encoding on the proxy device SN to obtain a byte array B12, and then encode the length of B12 to obtain a byte B13; then perform variable-length integer encoding on the proxy data length L3 to obtain a byte array B14; then encode the data, firstly encode the control byte B15 of a single data stream according to whether BizTime exists in the current data and the data encoding type, if BizTime exists, encode the timestamp data into an 8-word array B16; then perform utf-8 encoding on the data stream name to obtain a byte array B17, and then encode the length of B17 to obtain a byte B18; then encode the real data according to the encoding type to obtain byte data B19, and then perform variable-length integer encoding on the length of B19 to obtain a byte array B20; loop L3 times to complete the encoding of the current device data; loop L2 times to complete the encoding of the proxy device data; otherwise, proceed to step T7;

[0071] Step T7: Assemble the data in the encoding process into a binary array; the structure is: B1+B2[+B3][+B4+B5[+B6]+B8+B7++B10+B9]{L1}[+B11(+B13+B12+B14+B15[+B16]+B18+B17++B20+B19]){L3}]{12};

[0072] In the formula, {n} means that the previous expression is repeated n times, [] means that the expression is optional, and () means that the expression must exist.

[0073] Among them, the decoding process of the pseudocode is as follows:

[0074] Step J1: read the first byte to represent the version number, and read the second byte to represent the control byte;

[0075] Step J2: If the first bit of the control byte read in the first step is 1, the next 8 bytes read are global service timestamp data, otherwise proceed directly to step J3;

[0076] Step J3: If the second bit of the control byte read in the first step is 1, proceed to step J4, otherwise skip step J4;

[0077] Step J4: read the own data stream, read the variable-length integer representing the amount of data N of the agent itself; then loop N times to read the single data stream data, then proceed to step J5, until the reading of N data stream data is completed, and the reading of the own data is completed, then proceed to step J6;

[0078] Step J5: Reading a single data stream: The first step is to read the first byte to represent the control byte, and read the four bits after the first byte to represent the data encoding type. If the first bit of the first byte is 1, then read the subsequent eight bytes to represent the local business timestamp BizTime; then read a byte to represent the data stream name length Y1, and then read Y1 bytes to represent the data stream name; then read the variable-length positive number [1] Y2, and then read Y2 bytes to represent the real data, completing the reading of a data stream;

[0079] Step J6: If the third bit of the control byte read in the first step is 1, then read and proceed to step J7, otherwise the reading is completed;

[0080] Step J7: Read the proxy device data stream, read the variable-length integer data to obtain the proxy device data volume M; then loop M times to read the proxy device data stream data, and then proceed to step J8 until M proxy device data streams are read and decoding is completed;

[0081] Step J8: Read the proxy device data stream data, read the variable-length integer data to obtain the proxy device SN length Y3, and then read Y3 bytes to represent the proxy device SN; then read a byte to represent the proxy device data volume X, and then loop X times to read a single data stream data, and then proceed to step J5 until the reading of X data stream data is completed.

[0082] Embodiment 1:

[0083] See also Figure 3 As shown, this application document provides a proprietary protocol coding design optimization for the data model of the gateway data collection and transmission to the platform, and the solution includes:

[0084] The design of the general batch data model includes the minimum required data. The model data description is: BizTime (business data timestamp), self (own data), proxy (proxy sub-device data), stream (data stream channel name), encodeType (data encoding type), data (data point).

[0085] Customized data model coding design. The following will introduce the customized data model coding in detail.

[0086] The data model is a description of things, and in order to make users understand and use it better, it is usually expressed in the form of JSON objects. JSON can describe the data model well, but it is not friendly to data transmission support and often transmits more useless data: such as symbolic data such as {,}, :, " and object attribute description (JSON key value). The truly meaningful transmission data is the value corresponding to the key. The collection gateway usually reports a large amount of data at a time, and the traffic cost of the gateway device will increase dramatically.

[0087] This application document fully describes the batch data model by designing byte encoding, and designs a standard process for encoding and decoding of proprietary protocol data.

[0088] The coded message is described as follows:

[0089] The message contains three types of data: control byte, data description byte and data byte.

[0090] Control byte: Use bits to describe model characteristics, such as whether there is business time, whether there is own data, and whether there is proxy data;

[0091] Data description byte: describes the length of the data, and describes the encoding of some variable-length data, such as the length of string data, the length of array, etc.

[0092] Data byte: Encode the data into the corresponding byte array. Finally, combine the byte arrays in the order of the data model to obtain the optimized encoded transmission data.

[0093] The message design is described as follows:

[0094] The message contains three parts: the overall header, the data stream itself, and the proxy device data stream. (Note: The following identification bits are uniformly marked with 1 for yes and 0 for no);

[0095] Overall header: The first byte indicates the version number, the second byte indicates the overall control byte, and 8 bytes of optional bytes. Second byte: The first bit indicates whether there is a global business timestamp (BizTime); the second bit indicates whether there is self-data stream data. When the bit value is 1, it is necessary to read the self-data stream data; the third bit indicates whether there is proxy data stream data. When the bit value is 1, it is necessary to read the proxy device data stream data; the last five bits are reserved.

[0096] Self-data stream: The first 1-2 bytes indicate the amount of data N of the proxy itself, followed by N single data stream data.

[0097] Proxy device data stream: The first 1-2 bytes represent the amount of proxy device data M, followed by M proxy device data.

[0098] Proxy device data: The first byte indicates the device SN length Y3, the following Y3 bytes are the device SN data, and the following 1-2 bytes indicate the amount of data in a single data stream X. The following is X single data stream data.

[0099] Single data stream data: The first byte is the control byte: The first bit identifies whether there is a local business timestamp (BizTime). When the bit is 1, the next 8 bytes are the local data stream business timestamp data (BizTime); the next three bits are reserved bits, and the last four bits indicate the data encoding type; followed by 8 bytes of local data stream business timestamp data BizTime (optional); followed by a byte indicating the data stream name length Y1; followed by Y1 bytes for the data stream name; followed by 1-3 bytes of variable-length integer data, indicating the length of the real data Y2, followed by Y2 bytes for the real data.

[0100] Embodiment 2:

[0101] like Figure 4 As shown, the specific process of encoding the pseudocode is as follows:

[0102] Step 1: Encode the version number into one byte B1;

[0103] Step 2: Encode the overall control byte B2 based on whether there is a global BizTime, whether there is self-data, and whether there is proxy data. If BizTime exists, encode the timestamp data into an 8-byte array B3, and the overall header encoding is completed;

[0104] Step 3: If there is self-data, encode the self-data and go to step 4, otherwise go to step 5;

[0105] Step 4: First, perform variable-length integer encoding (1-2 bytes) B4 on the length of the data array L1; then encode the data, firstly encode the control byte B5 of a single data stream according to whether the current data has BizTime and the data encoding type, if BizTime exists, encode the timestamp data into an 8-word array B6; then encode the data stream name utf-8 to obtain a byte array B7, and then encode the length of B7 to obtain a byte B8; then encode the real data according to the encoding type to obtain byte data B9, and then perform variable-length integer encoding on the length of B9 to obtain a byte array B10 (1-4 bytes); loop L1 times to complete the encoding of the data. Then proceed to step 5;

[0106] Step 5: If there is proxy data, encode the proxy data and go to step 6; otherwise, go to step 7;

[0107] Step 6: First, perform variable-length integer encoding on the proxy device data length L2 to obtain a byte array B11; then perform utf-8 encoding on the proxy device SN to obtain a byte array B12, and then encode the length of B12 to obtain a byte B13; then perform variable-length integer encoding on the proxy data length L3 to obtain a byte array B14; then encode the data, firstly encode the control byte B15 of a single data stream according to whether BizTime exists in the current data and the data encoding type, if BizTime exists, encode the timestamp data into an 8-word array B16; then perform utf-8 encoding on the data stream name to obtain a byte array B17, and then encode the length of B17 to obtain a byte B18; then encode the real data according to the encoding type to obtain byte data B19, and then perform variable-length integer encoding on the length of B19 to obtain a byte array B20 (1-4 bytes); loop L3 times to complete the encoding of the current device data; loop L2 times to complete the encoding of the proxy device data.

[0108] Otherwise, proceed to step 7;

[0109] Step 7: Assemble the data in the encoding process into a binary array. The structure is:

[0110] B1+B2[+B3][+B4+B5[+B6]+B8+B7++B10+B9]{L1}[+B11(+B13+B12+B14+B15[+B16]+B18+B17++B20+B19]){L3}]{12}. Among them: {n} means the preceding expression is repeated n times, [] means the expression is optional, and () means the expression must exist.

[0111] Embodiment three:

[0112] like Figure 5 As shown, the specific process of encoding the pseudocode is as follows:

[0113] Step 1: Read the first byte to represent the version number, and read the second byte to represent the control byte;

[0114] Step 2: If the first bit of the control byte read in the first step is 1, the next 8 bytes read are the global business timestamp data (BizTime), otherwise proceed directly to step 3;

[0115] Step 3: If the second bit of the control byte read in the first step is 1, proceed to step 4, otherwise skip step 4;

[0116] Step 4: Read the own data stream, read the variable-length integer to represent the amount of data N of the agent itself; then loop N times to read the single data stream data, then proceed to step 5, until the reading of N data stream data is completed, and the reading of the own data is completed, then proceed to step 6;

[0117] Step 5: Read a single data stream: The first step is to read the first byte to represent the control byte, and read the four bits after the first byte to represent the data encoding type. If the first bit of the first byte is 1, then read the following eight bytes to represent the local business timestamp BizTime; then read a byte to represent the length of the data stream name Y1, and then read Y1 bytes to represent the data stream name; then read the variable-length positive number [1] Y2, and then read Y2 bytes to represent the real data, completing the reading of a data stream;

[0118] Step 6: If the third bit of the control byte read in the first step is 1, then read it and proceed to step 7, otherwise the reading is completed;

[0119] Step 7: Read the proxy device data stream, read the variable-length integer data to obtain the proxy device data volume M; then loop M times to read the proxy device data stream data, and then proceed to step 8 until M proxy device data streams are read and decoding is completed;

[0120] Step 8: Read the proxy device data stream data, read the variable-length integer data to obtain the proxy device SN length Y3, and then read Y3 bytes to represent the proxy device SN; then read a byte to represent the proxy device data volume X, and then loop X times to read a single data stream data, and then proceed to step 5 until the reading of X data stream data is completed.

[0121] It is worth noting that in the above system embodiment, the various units included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0122] In addition, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiments can be completed by instructing related hardware through a program, and the corresponding program can be stored in a computer-readable storage medium.

[0123] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for collecting and reporting data from multiple monitoring points of a gateway, characterized in that: The steps include: Step S1: The hardware developer defines the monitoring point device model on the platform according to the monitoring device data, and defines the data encoding and data transmission channel; Step S2: Establishing a proxy relationship between the gateway and the sub-device on the platform according to the relationship between the real acquisition gateway and the real proxy device, ensuring that the platform layer can verify the proxy relationship; Step S3: The hardware developer integrates and develops batch data aggregation and reporting capabilities for the acquisition gateway; Step S4: The gateway layer collects the monitoring point equipment data and encodes and aggregates the data using the batch data general module; Step S5: The collection gateway reports batch aggregated data to the platform using the MQTT protocol; Step S6: The platform receives and processes the data; Step S7: The SaaS platform developer receives the monitoring point data; In step S3, batch data aggregation requires the design of a general batch data model, which contains the minimum data required; the data model includes business data timestamp, own data, proxy sub-device data, data stream channel name, data encoding type and data point; In step S5, when designing the data model for the data collected and transmitted to the platform by the gateway using its own protocol coding, the pseudocode needs to be encoded and decoded; wherein, the encoding process of the pseudocode is as follows: Step T1: Encode the version number into one byte B1; Step T2: Encode the overall control byte B2 according to whether there is a global BizTime, whether there is its own data, and whether there is proxy data. If BizTime exists, encode the timestamp data into an 8-byte array B3, and the overall header encoding is completed; Step T3: If the self data exists, encode the self data and go to step B4, otherwise go to step T5; Step T4: First, variable-length integer encoding B4 is performed on the length of the data array L1; then the data is encoded, firstly, the control byte B5 of a single data stream is encoded according to whether BizTime exists in the current data and the data encoding type. If BizTime exists, the timestamp data is encoded into an 8-word array B6; then the data stream name is encoded in utf-8 to obtain a byte array B7, and then the length of B7 is encoded to obtain a byte B8; then the real data is encoded according to the encoding type to obtain byte data B9, and then the length of B9 is variable-length integer encoded to obtain a byte array B10; the encoding of the data itself is completed by looping L1 times, and then the process goes to step T5; Step T5: If the proxy data exists, encode the proxy data and proceed to step B6; otherwise proceed to step T7; Step T6: First, perform variable-length integer encoding on the proxy device data length L2 to obtain a byte array B11; then perform utf-8 encoding on the proxy device SN to obtain a byte array B12, and then encode the length of B12 to obtain a byte B13; then perform variable-length integer encoding on the proxy data length L3 to obtain a byte array B14; then encode the data, firstly encode the control byte B15 of a single data stream according to whether BizTime exists in the current data and the data encoding type, if BizTime exists, encode the timestamp data into an 8-word array B16; then perform utf-8 encoding on the data stream name to obtain a byte array B17, and then encode the length of B17 to obtain a byte B18; then encode the real data according to the encoding type to obtain byte data B19, and then perform variable-length integer encoding on the length of B19 to obtain a byte array B20; loop L3 times to complete the encoding of the current device data; loop L2 times to complete the encoding of the proxy device data; otherwise, proceed to step T7; Step T7: Assemble the data in the encoding process into a binary array; the structure is: B1+B2[+B3][+B4+B5[+B6]+B8+B7++B10+B9]{L1}[+B11(+B13+B12+B14+B15[+B16]+B18+B17++B20+B19]){L3}]{12}; In the formula, {n} means that the previous expression is repeated n times, [] means that the expression is optional, and () means that the expression must exist.

2. According to claim 1, a method for collecting gateway multi-monitoring point data aggregation and reporting is characterized in that: In step S4, the batch data general module designs the batch data model by using byte encoding.

3. The method for collecting and reporting data from multiple monitoring points of a gateway according to claim 1, characterized in that: In step S5, batch aggregated data is sent to the platform in the form of a message; the message is provided with three types of data: a control byte, a data description byte and a data byte; the control byte is used to describe the model characteristics through bits; the data description byte is used to describe the data length; the data byte is used to encode the data into a corresponding byte array and combine the byte arrays in the order of the data model to obtain optimized encoded transmission data.

4. A method for collecting and reporting data from multiple monitoring points of a gateway according to claim 3, characterized in that: The message includes an overall header, its own data stream and a proxy device data stream; the overall header includes a first byte representing a version number, a second byte representing an overall control byte and 8 bytes of optional bytes; the own data stream, the first byte represents the proxy's own data volume N, and the rest represent N single data stream data; the proxy device data stream, the first byte represents the proxy device data volume M, and the rest represent M proxy device data.

5. A method for collecting and reporting data from multiple monitoring points of a gateway according to claim 4, characterized in that: The second byte of the overall header needs to determine whether the first bit identifies whether there is a global business timestamp. When the bit value is 1, the business time data needs to be read; the second bit identifies whether there is own data stream data; when the bit value is 1, the own data stream data needs to be read; the third bit identifies whether there is proxy data stream data. When the bit value is 1, the proxy device data stream data needs to be read, and the remaining five bits are reserved bits.

6. A method for collecting and reporting multi-monitoring point data from a gateway according to claim 4, characterized in that: The first byte of the proxy device data indicates the device SN length Y3, the following Y3 bytes are the device SN data, and the following 1-2 bytes indicate the data volume X of a single data stream, followed by X single data stream data.

7. A method for collecting and reporting multi-monitoring point data from a gateway according to claim 4, characterized in that: The first byte of the single data stream data is the control byte, and the first bit identifies whether there is a local business timestamp; when the bit is 1, the next 8 bytes are local data stream business timestamp data; the next three bits are reserved bits, and the last four bits indicate the encoding type of the data, followed by 8 bytes of local data stream business timestamp data, followed by a byte indicating the data stream name length Y1, followed by Y1 bytes of the data stream name; followed by 1-3 bytes of variable-length integer data, indicating the length Y2 of the real data, followed by Y2 bytes of the real data.

8. The method for collecting and reporting data from multiple monitoring points of a gateway according to claim 1, characterized in that: The decoding process of the pseudocode is as follows: Step J1: read the first byte to represent the version number, and read the second byte to represent the control byte; Step J2: If the first bit of the control byte read in the first step is 1, the next 8 bytes read are global service timestamp data, otherwise proceed directly to step J3; Step J3: If the second bit of the control byte read in the first step is 1, proceed Step J4, otherwise skip step J4; Step J4: read the own data stream, read the variable-length integer representing the amount of data N of the agent itself; then loop N times to read the single data stream data, then proceed to step J5, until the reading of N data stream data is completed, and the reading of the own data is completed, then proceed to step J6; Step J5: Reading a single data stream: The first step is to read the first byte to represent the control byte, and read the four bits after the first byte to represent the data encoding type. If the first bit of the first byte is 1, then read the subsequent eight bytes to represent the local business timestamp BizTime; then read a byte to represent the data stream name length Y1, and then read Y1 bytes to represent the data stream name; then read the variable-length positive number [1] Y2, and then read Y2 bytes to represent the real data, completing the reading of a data stream; Step J6: If the third bit of the control byte read in the first step is 1, then read and proceed to step J7, otherwise the reading is completed; Step J7: Read the proxy device data stream, read the variable-length integer data to obtain the proxy device data volume M; then loop M times to read the proxy device data stream data, and then proceed to step J8 until M proxy device data streams are read and decoding is completed; Step J8: Read the proxy device data stream data, read the variable-length integer data to obtain the proxy device SN length Y3, and then read Y3 bytes to represent the proxy device SN; then read a byte to represent the proxy device data volume X, and then loop X times to read a single data stream data, and then proceed to step J5 until the reading of X data stream data is completed.

Citation Information

Patent Citations

  • Internet-of-things-based data acquisition system and data compression method based on the same

    CN107390650A

  • Storage method and storage system for Internet of Things monitoring big data

    CN109495537A

  • Data encoding method, decoding method, encoding and decoding method, equipment and storage medium

    CN110690943A

  • Customized communication protocol and service method based on netty framework

    CN111683069A

  • Data aggregation method and system based on smart power grid and storage medium

    CN111897892A