Disclosure of Invention
The invention aims to provide a multi-interval wave recording data transmission method, a system, a device and a storage medium, which ensure the accuracy and the integrity of the fault wave recording data of a cable line, effectively reduce the transmitted data volume and obviously shorten the transmission time.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides a multi-interval wave recording data transmission method for a power distribution network cable line, which comprises the following steps:
acquiring cycle sampling data of voltage and current to buffer 256 original sampling data with 16 bits;
performing data compression on the original sampling data by using a differential compression algorithm to obtain a differential compressed data frame, and transmitting the differential compressed data frame to a communication opposite terminal;
decompressing in the opposite communication terminal to obtain the restored original sampling data.
Optionally, the cycle sample data is original sample data of 256 points with 16 bits.
Optionally, the 16-bit 256-point original sampling data is acquired through an analog-to-digital conversion chip ADC in the intelligent terminal device.
Optionally, the original sample data is subjected to data compression by using a differential compression algorithm to obtain compressed sample data, and the specific method includes:
constructing a differential compressed data frame memory, wherein the frame memory consists of original data Si, bit width marks H i and differential data D i;
extracting original sampling data S0, S1 from 256 16 bit original sampling data S0, S1, S2, …, S255;
calculating differential data D [2], …, D [255] from the original sample data S [0], S [1] by calculating an expression D [ i ] ═ (int16_ t) (S [ i ] -S [ i-1] + S [ i-2]) (i ═ 2,3,4, …,255), such that D [0] ═ D [1] ═ 0;
dividing the differential data D [0], D [1], D [2], …, D [255] into 16 groups, wherein the bit width of each group of differential data is B [0], B [1], B [2], …, B [15] bits;
determining a bit width flag of each set of differential data, wherein the bit width B [ i ] of each set of differential data is determined by a bit width flag H [ i ] (i ═ 0 … 15), where H [ i ] ═ 0,1,2, and 3 correspond to B [ i ] ═ 4,8,12, and 16, respectively (i ═ 0,1,2, …, and 15);
if the set of differential data all belong to the interval [ -8,7], the bit width B of the set of differential data is 4 bits, and the flag H is 0;
if the set of differential data all belong to the interval [ -128,127], the bit width B of the set of differential data is 8 bits, and the flag H is 1;
if the set of differential data all belong to the interval [ -2048,2047], the bit width B of the set of differential data is 12 bits, and the flag H is 2;
if the set of differential data all belong to the interval [ -32768,32767], and therefore the bit width B of the set of differential data is 16 bits, the flag H is 3;
and respectively filling the original data Si, the bit width mark H i and the differential data D i obtained in the steps into a frame memory, wherein the differential data D i are continuously stored in a small-end mode to obtain a differential compressed data frame.
Optionally, decompressing in the correspondent node to obtain the restored original sample data, and the specific manner is as follows:
extracting H0, H1, H2, …, H15 and S0, S1 from the differential compressed data frame;
for each tag H [0], H [1], H [2], …, H [15], its corresponding bit width B [0], B [1], B [2], …, B [15] is determined as follows:
if the flag H is 0, the bit width B is 4 bits;
if the flag H is 1, the bit width B is 8 bits;
if the flag H is 2, the bit width B is 12 bits;
if the flag H is 3, the bit width B is 16 bits.
Based on bit width B0, B1, B2, …, B15, taking out D0, D1, D2, …, D255 as "2 complement" signed number;
according to a calculation formula S [ i ] (int16_ t) (S [ i-1] + S [ i-1] -S [ i-2] + D [ i ]) (i ═ 2,3,4, …,255), original sampling data are calculated and decompressed.
Optionally, when the differential compressed data frame is transmitted to a communication peer, a data bus is used for data transmission.
Optionally, the communication peer is an upper computer.
In a second aspect of the present invention, a system for the method for transmitting multi-interval recording data is provided, including:
the sampling module is used for acquiring cycle sampling data of voltage and current to buffer the cycle sampling data into 256 original sampling data with 16 bits;
the compression module is used for carrying out data compression on the original sampling data by using a differential compression algorithm to obtain a differential compressed data frame, and transmitting the differential compressed data frame to a communication opposite terminal;
and the decompression module is used for decompressing in the communication opposite terminal to obtain the restored original sampling data.
In a third aspect of the present invention, there is provided a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the multi-interval recording data transmission method when executing the computer program.
In a fourth aspect of the present invention, a computer-readable storage medium is provided, where a computer program is stored, and when the computer program is executed by a processor, the method for transmitting multi-interval recording data is implemented.
The invention has the following beneficial effects:
the multi-interval wave recording data transmission method provided by the embodiment of the invention adopts a compression algorithm of 16-bit sampling data and uses a differential compression principle to extract the first 2 original sampling data as a differential reference of a newly generated compressed file, and the subsequent sampling data takes the original data as a reference to calculate bit width and differential value, so as to finally generate a compressed data packet. When the generated compression packet improves the data compression capacity, the method is compatible with the existing power distribution terminal equipment adopting 12-bit sampling bits, and can shorten the transmission time of multi-interval wave recording data in the terminal equipment.
Detailed Description
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
The following detailed description is exemplary in nature and is intended to provide further details of the invention. Unless otherwise defined, all technical terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention.
The embodiment of the invention provides a method, a system, a device and a storage medium for transmitting multi-interval wave recording data of a power distribution network cable line, which support the decompression of 16-bit sampling data and solve the problem that the transmission time consumption in terminal equipment is longer due to the larger multi-interval wave recording data amount of the cable line, and possibly causes the misjudgment or the failure of a fault section. The accuracy and the integrity of the cable line fault recording data are ensured, the transmitted data volume is effectively reduced, and the transmission time is obviously shortened.
As shown in fig. 1, in a first aspect of the present invention, a method for transmitting multi-interval recording data for a cable line of a power distribution network is provided, which includes the following steps:
s1, acquiring cycle sampling data of voltage and current to buffer into 256 original sampling data with 16 bits; the cycle sampling data is original sampling data of 256 points with 16 bits, and the original sampling data of the 256 points with 16 bits is collected through an analog-to-digital conversion chip ADC in the intelligent terminal equipment. In a cable line, the intelligent terminal device is generally provided with a plurality of lines and a plurality of spaced acquisition modules, each acquisition module can independently acquire three-phase voltage and current of one line, and the acquisition modules are in communication interaction with the main control module through a data center line. The cyclic sampling data of the three-phase voltage or current of each line needs to be buffered to form 256 original sampling data with 16 bits for the next data processing.
And S2, performing data compression on the original sampling data by using a differential compression algorithm to obtain a differential compressed data frame, and transmitting the differential compressed data frame to a communication opposite terminal by using a data bus.
As an example, the differential compression algorithm inputs are 256 16-bit integers S0, S1, S2, …, S255, referred to as raw data. The differential compression algorithm outputs as a bit stream, called a frame. The length is 1088 bits at minimum, 4160 bits at maximum, and is a multiple of 32 bits. The storage bit order and byte order of a frame in memory are both "small-endings". The frame is formed by compactly connecting a plurality of integers, and the bit sequence of each integer is 'small end'.
As shown in fig. 2, a specific method for performing data compression on the original sample data by using a differential compression algorithm to obtain a differential compressed data frame is as follows:
s21, constructing a differential compressed data frame memory, wherein the frame memory consists of original data Si, bit width labels Hi and differential data Di; see table 1 for details;
s22, extracting original sampling data S0, S1 from 256 original sampling data S0, S1, S2, …, S255 with 16 bits;
s23, according to the original sampling data S [0], S [1], calculating the expression:
D[i]=(int16_t)(S[i]-S[i-1]-S[i-1]+S[i-2])(i=2,3,4,…,255)
calculating to obtain difference data D [2], …, D [255], and making D [0] ═ D [1] ═ 0;
s24, dividing the differential data D [0], D [1], D [2], … and D [255] into 16 groups, wherein the bit width of each group of differential data is B [0], B [1], B [2], … and B [15] bits;
s25, determining a bit width flag of each set of differential data, where the bit width B [ i ] of each set of differential data is determined by a bit width flag H [ i ] (i ═ 0 … 15), where H [ i ] ═ 0,1,2, and 3 correspond to B [ i ] ═ 4,8,12, and 16(i ═ 0,1,2, …, and 15), respectively;
(1) if the set of differential data all belong to the interval [ -8,7], the bit width B of the set of differential data is 4 bits, and the flag H is 0;
(2) if the set of differential data all belong to the interval [ -128,127], the bit width B of the set of differential data is 8 bits, and the flag H is 1;
(3) if the set of differential data all belong to the interval [ -2048,2047], the bit width B of the set of differential data is 12 bits, and the flag H is 2;
(4) if the set of differential data all belong to the interval [ -32768,32767], and therefore the bit width B of the set of differential data is 16 bits, the flag H is 3;
s26, filling the original data Si, bit width mark H i and difference data D i obtained in the above steps into frame memory, wherein the difference data D i is stored continuously in small end mode to obtain difference compressed data frame, when D i occupies less bit width, the data size of the whole compressed data frame will be less, playing the role of data compression.
And S3, decompressing in the opposite communication terminal to obtain the restored original sampling data.
Specifically, the generated original sampling data of three-phase voltage and current is collected through a sampling module of the intelligent terminal device, and after differential compression, a differential compression data frame is generated. After the data frames are transmitted to the opposite communication terminal, the opposite terminal needs to correspondingly perform decompression algorithm processing. The input frames to the decompression algorithm must be the compressed data frames generated in step 3, and the decompression algorithm outputs the restored original data S [0], S [1], S [2], …, S [255 ].
As shown in fig. 3, the specific way of decompression is as follows:
s31, extracting H0, H1, H2, …, H15, S0 and S1 from the differential compressed data frame;
s32, determining the bit width B [0], B [1], B [2], …, B [15] corresponding to each mark H [0], H [1], H [2], …, H [15] according to the following method:
(1) if the flag H is 0, the bit width B is 4 bits;
(2) if the flag H is 1, the bit width B is 8 bits;
(3) if the flag H is 2, the bit width B is 12 bits;
(4) if the flag H is 3, the bit width B is 16 bits.
S33, according to bit width B0, B1, B2, …, B15, taking out D0, D1, D2, …, D255 as '2 complement' signed number;
and S34, calculating to obtain original sampling data according to a calculation formula S [ i ] (int16_ t) (S [ i-1] + S [ i-1] -S [ i-2] + D [ i ]) (i-2, 3,4, … and 255), and realizing decompression.
In a second aspect of the present invention, a system for the method for transmitting multi-interval recording data is provided, including:
the sampling module is used for acquiring cycle sampling data of voltage and current to buffer the cycle sampling data into 256 original sampling data with 16 bits;
the compression module is used for carrying out data compression on the original sampling data by using a differential compression algorithm to obtain a differential compressed data frame, and transmitting the differential compressed data frame to a communication opposite terminal;
and the decompression module is used for decompressing in the communication opposite terminal to obtain the restored original sampling data.
In a third aspect of the present invention, there is provided a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the multi-interval recording data transmission method when executing the computer program.
In a fourth aspect of the present invention, a computer-readable storage medium is provided, where a computer program is stored, and when the computer program is executed by a processor, the method for transmitting multi-interval recording data is implemented.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be appreciated by those skilled in the art that the invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The embodiments disclosed above are therefore to be considered in all respects as illustrative and not restrictive. All changes which come within the scope of or equivalence to the invention are intended to be embraced therein.