CN110677156A - Compression algorithm and decompression method for black and white dot matrix data in power system protection device - Google Patents

Compression algorithm and decompression method for black and white dot matrix data in power system protection device Download PDF

Info

Publication number
CN110677156A
CN110677156A CN201910885649.9A CN201910885649A CN110677156A CN 110677156 A CN110677156 A CN 110677156A CN 201910885649 A CN201910885649 A CN 201910885649A CN 110677156 A CN110677156 A CN 110677156A
Authority
CN
China
Prior art keywords
data
counter
byte
dot matrix
black
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910885649.9A
Other languages
Chinese (zh)
Inventor
陈超
李鹏
习伟
匡晓云
姚浩
丁毅
陈新之
崔岩峰
商巍
章鑫杰
赵勇军
董腾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China South Power Grid International Co ltd
Nanjing SAC Automation Co Ltd
Original Assignee
Nanjing SAC Automation Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing SAC Automation Co Ltd filed Critical Nanjing SAC Automation Co Ltd
Priority to CN201910885649.9A priority Critical patent/CN110677156A/en
Publication of CN110677156A publication Critical patent/CN110677156A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Control Of Indicators Other Than Cathode Ray Tubes (AREA)

Abstract

The invention relates to a compression algorithm of black-and-white dot matrix data in a power system protection device, which comprises the following steps of S01, reading original dot matrix data of one byte, judging whether the current byte is 0x00 or 0xFF, copying the read original data to a compressed data writing position if the current byte is not 0x00 or 0xFF, and carrying out the next step if the current byte is not 0x00 or 0 xFF; s02, copying the read original data into the compressed data and starting counting, wherein the counted number is the same as the number of the continuous original data of the current byte; and S03, reading the byte which is different from the original data in the step S02, and returning to the step S01, wherein the algorithm has good actual engineering application effect, the data volume is reduced by 35% on average, and the data volume of the individual interface can be reduced by 99%.

Description

Compression algorithm and decompression method for black and white dot matrix data in power system protection device
Technical Field
The invention relates to a data compression method, in particular to a compression algorithm and a decompression method of black and white dot matrix data in a power system protection device.
Background
The secondary equipment of the power system is mainly used in a transformer substation, and the surrounding electromagnetic environment is extremely complex. In practical engineering, it is found that if the screen on the panel is directly connected to the management CPU board through the driver chip plus the LCD flat cable, the screen display is easily abnormal due to the harsh electromagnetic environment. To prevent this, the screen is connected to the management CPU via a bus with a check. The management CPU transmits black and white dot matrix data to the Panel through a bus with verification, such as an Ethernet bus, in the transmission process, due to the large data volume, a large number of completely black or completely white parts can appear on the dot matrix data of one screen, for the two cases, the data taking bytes as a unit is either all 0xFF or all 0, and the transmission efficiency and the transmission quality are influenced by the large data transmission.
Disclosure of Invention
The invention aims to provide a flexible and efficient compression mechanism for black and white screens, so that the data volume of dot matrix data transmitted to the screens by a management CPU is minimized, the data transmission efficiency is improved, and the user experience is improved.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
the compression algorithm of black and white dot matrix data in the power system protection device comprises the following steps
S01, reading original dot matrix data of one byte, judging whether the current byte is 0 or 0xFF, if not, copying the read original data to a compressed data writing position, and if so, carrying out the next step;
s02, copying the read original data into the compressed data and starting counting, wherein the counted number is the same as the number of the continuous original data of the current byte;
when the S03 reads a byte different from the original data in the step S02, the process returns to the step S01.
Further, in the step S02, the counter is counted by using a counter.
Further, when the count number reaches 255 in the step S02, the count number is copied to the compressed data, and then the counter is cleared by 0, and then the process returns to S01.
Further, the counting rule is: in step S01, if the read data is 0 or 0xFF, the counter is set to 1, otherwise the counter is cleared to 0.
Further, when the original data of the previous byte is the same as the original data of the current byte, the counter is added by 1, if the counter reaches 0xFF, the counter value is copied to the current position of the compressed data, and then the counter is cleared by 0.
The invention also relates to a decompression algorithm for the black and white dot matrix data compression algorithm in the power system protection device, which comprises the following steps
S01, reading one byte of compressed data from the read pointer position of the source data;
s02 if the data is not 0x00 or 0xFF, copying the data to a destination buffer; otherwise, repeatedly copying 0x00 or 0xFF to the destination buffer; wherein the number of repetitions is determined by the value of the next position of the read pointer in the source data buffer.
The beneficial effects produced by the invention comprise: the next byte of each 0xFF or 0 in the compression algorithm represents the number of 0xFF or 0. Bytes other than 0 and 0xFF remain unchanged. After the compression by the algorithm, in practical engineering application, the black-and-white dot matrix data per second is reduced from 480K bytes to about 168K bytes, which is about 35% of the original data. Preferably, the amount of data transferred is only 0.78% of the original amount when the screen is fully black or fully white.
The algorithm is a lossless compression algorithm, the algorithm can copy data and compress the data at the same time without traversing the data for two times, the algorithm can copy the data and decompress the data at the same time, the decompression of the front data is irrelevant to the rear data, the actual engineering application effect of the algorithm is good, the data volume is reduced by 35 percent on average, and the data volume of the special interface is reduced by 99 percent.
Drawings
FIG. 1 is a flow chart of a compression method of the present invention;
FIG. 2 illustrates a typical black and white liquid crystal lattice interface.
Detailed Description
The present invention is explained in further detail below with reference to the drawings and the specific embodiments, but it should be understood that the scope of the present invention is not limited to the specific embodiments.
As shown in FIG. 1, the method of the present invention
The method comprises the following steps:
1. the method comprises the steps that a management CPU reads original dot matrix data of one byte first, if the read data are 0 or 0xFF, a counter in the management CPU starts counting, and if the read data are not 0x00 or 0xFF, the counter does not count, and the counter is zero;
2. if the compressed data counter of the management CPU has started counting, go to step 3; otherwise, jumping to the step 5;
3. if the original data of the previous byte is the same as the original data of the current byte, directly going to step 4; otherwise, the value of the counter is copied to the compressed data writing position, and then the original data of the current byte is copied to the next position of the compressed data. If the copied data is 0x00 or 0xFF, the counter is set to 1, otherwise the counter is cleared to 0 and the process returns to step 1.
4. And when the data of the previous byte is the same as the data of the current byte, the counter is added by one. If the counter reaches 255, the counter is copied to the current position of the compressed data, then the counter is cleared, and the step 1 is returned to.
5. The counter is 0, which indicates that the previous original byte data is not 0x00 or 0xFF, the latest original data is read and the value is copied into the compressed data, and if the value is not 0x00 or 0xFF, the step 1 is directly returned to; otherwise, the counter is set to 1, and then the procedure returns to step 1.
The above summary is to read the original data, if the original data is 0x00, the counter shows 1, then sequentially reads the following bytes, if the following data is next to n 0x00, the counter finally shows n +1, then the n +1 0 final compression result is 0x00 n +1, where n +1 < 255;
if n +1 ≧ 255, the compression reaches 255 as 0x 00255, and then recounted and compressed to 0x00 n-254.
The counting method of 0xFF is the same as 0x 00.
If the original data is not 0x00 or 0xFF, the read original data is directly written into the compressed data.
And compressing the bytes in sequence according to the method to form new compressed data.
Examples of the invention
The compressed data is as follows:
0x50,0xFF,0xFF,0xFF,0x03,0x0,0xFF,0x00,0x03,0x03
the above row of compressed data is explained in detail as follows:
the first byte: 0x50 represents an uncompressed data
Second, three bytes: 0xFF,0xFF represents 255 0 xFFs
Fourth, five bytes: 0xFF,0x03 denotes 3 0 xFFs
Sixth, seven bytes: 0x00,0xFF represents 255 0x00
Eighth, nine bytes: 0x00,0x03 represents 3 pieces of 0x00
The tenth byte: 0x03 represents an uncompressed data.
The following is a decompression flow of the FF0 decompression algorithm, and it is assumed that data compressed by the relay protection device is placed in a source data buffer and a decompressed result is placed in a destination data buffer.
1. One byte of compressed data is first read from the read pointer location of the source data buffer.
2. If the data is not 0x00 or 0xFF, copying the data to a destination data buffer; otherwise, repeatedly copying the 0x00 or 0xFF data to the destination data buffer; where the number of repetitions is determined by the next position of the source data buffer read pointer.
A typical black-white liquid crystal lattice interface shown in the following figure 2 is compressed by an FF0 compression algorithm, and the transmitted data volume is actually measured to be reduced to 23.36 percent of the original data volume
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the content of the embodiment. It will be apparent to those skilled in the art that various changes and modifications can be made within the technical scope of the present invention, and any changes and modifications made are within the protective scope of the present invention.

Claims (6)

1. The compression algorithm of black and white dot matrix data in the power system protection device is characterized in that: comprises the following steps
S01, reading original lattice data of a byte, judging whether the current byte is 0x00 or 0xFF, if not, copying the read original data to a compressed data writing position, and if so, carrying out the next step;
s02, copying the read original data into the compressed data and starting counting, wherein the counted number is the same as the number of the continuous original data of the current byte;
when the S03 reads a byte different from the original data in the step S02, the process returns to the step S01.
2. The compression algorithm of black and white dot matrix data in the power system protection device according to claim 1, characterized in that: the count in said step S02 is counted using a counter.
3. The compression algorithm of black and white dot matrix data in the power system protection device according to claim 1, characterized in that: when the number of counts in the step S02 reaches 255, the counter value is copied to the counter clear 0 in the compressed data.
4. The compression algorithm of black and white dot matrix data in the power system protection device according to claim 1, characterized in that: the counting rule is as follows: in step S01, if the read data is 0x00 or 0xFF, the counter is set to 1, otherwise the counter is cleared to 0.
5. The compression algorithm of black and white dot matrix data in the power system protection device according to claim 4, characterized in that: and if the original data of the previous byte is the same as the original data of the current byte, the counter is added by 1, if the counter reaches 255, the counter value is copied to the current position of the compressed data, and then the counter is cleared by 0.
6. A decompression algorithm for a black and white dot matrix data compression algorithm in the power system protection device of claim 1, wherein: comprises the following steps
S01, reading one byte of compressed data from the read pointer position of the source data buffer;
s02 if the data is not 0x00 or 0xFF, copying the data to the destination data buffer; otherwise, repeatedly copying the 0x00 or 0xFF data to the destination data buffer; wherein the number of repetitions is determined by the value of the next position of the source data buffer read pointer.
CN201910885649.9A 2019-09-19 2019-09-19 Compression algorithm and decompression method for black and white dot matrix data in power system protection device Pending CN110677156A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910885649.9A CN110677156A (en) 2019-09-19 2019-09-19 Compression algorithm and decompression method for black and white dot matrix data in power system protection device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910885649.9A CN110677156A (en) 2019-09-19 2019-09-19 Compression algorithm and decompression method for black and white dot matrix data in power system protection device

Publications (1)

Publication Number Publication Date
CN110677156A true CN110677156A (en) 2020-01-10

Family

ID=69076894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910885649.9A Pending CN110677156A (en) 2019-09-19 2019-09-19 Compression algorithm and decompression method for black and white dot matrix data in power system protection device

Country Status (1)

Country Link
CN (1) CN110677156A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1928852A (en) * 2006-09-27 2007-03-14 北京大学 Grating treatment method and device for transparent page
CN1940995A (en) * 2005-09-29 2007-04-04 中国科学院自动化研究所 Method for compressing fingerprint direction quantized diagram to embedded system
CN101068352A (en) * 2007-06-08 2007-11-07 中兴通讯股份有限公司 Network image compressing method and system
CN101742212A (en) * 2008-11-10 2010-06-16 深圳市业通达实业有限公司 Image monitoring carrier
CN202888962U (en) * 2012-09-29 2013-04-17 上海市电力公司 Intelligentized unified management system for electric power video monitoring
CN103124350A (en) * 2012-12-24 2013-05-29 东软集团股份有限公司 Image compression method and device based on run-length encoding (RLE)
CN103347186A (en) * 2013-07-08 2013-10-09 南京国电南自电网自动化有限公司 Real-time transmission and remote control method for relay protection device human-computer interfaces
CN105046632A (en) * 2015-06-29 2015-11-11 湖南大学 Space-time efficient binary image binary logic operation method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1940995A (en) * 2005-09-29 2007-04-04 中国科学院自动化研究所 Method for compressing fingerprint direction quantized diagram to embedded system
CN1928852A (en) * 2006-09-27 2007-03-14 北京大学 Grating treatment method and device for transparent page
US20100053705A1 (en) * 2006-09-27 2010-03-04 Peking University Founder Group Co., Ltd Methods And Devices For Rasterizing Transparent Pages
CN101068352A (en) * 2007-06-08 2007-11-07 中兴通讯股份有限公司 Network image compressing method and system
CN101742212A (en) * 2008-11-10 2010-06-16 深圳市业通达实业有限公司 Image monitoring carrier
CN202888962U (en) * 2012-09-29 2013-04-17 上海市电力公司 Intelligentized unified management system for electric power video monitoring
CN103124350A (en) * 2012-12-24 2013-05-29 东软集团股份有限公司 Image compression method and device based on run-length encoding (RLE)
CN103347186A (en) * 2013-07-08 2013-10-09 南京国电南自电网自动化有限公司 Real-time transmission and remote control method for relay protection device human-computer interfaces
CN105046632A (en) * 2015-06-29 2015-11-11 湖南大学 Space-time efficient binary image binary logic operation method

Similar Documents

Publication Publication Date Title
JPH04227337A (en) Adaptive coding device using carry control and method therefor
US7327289B1 (en) Data-modifying run length encoder to avoid data expansion
CN109274377A (en) Data processing method, device, medium and the electronic equipment of block chain network
CN116506073B (en) Industrial computer platform data rapid transmission method and system
JP2017519467A5 (en)
CN113946402A (en) Cloud mobile phone acceleration method, system, equipment and storage medium based on rendering separation
EP3737100A1 (en) Encoding method, decoding method, and device
KR20150105486A (en) Data encoder, data decoder and method
AU600972B2 (en) Arithmetic coding encoder and decoder system
CN110677156A (en) Compression algorithm and decompression method for black and white dot matrix data in power system protection device
CN111917661A (en) Data transmission method and device, electronic equipment and computer readable storage medium
CN116708511B (en) Method, equipment and medium based on microcontroller integrated vehicle-machine interconnection technology
CA2457316A1 (en) Fault location method and device
CN104935406B (en) A kind of data compression of intelligent grid communication and decompression method and intelligent grid communication system
CN114339252B (en) Data compression method and device
CN110138509A (en) A kind of data transmission method and data transfer components
CN109614369A (en) A kind of document transmission method of test equipment
CN113162628B (en) Data encoding method, data decoding method, terminal and storage medium
TWI695591B (en) Data stepped compression transmission method and device and electronic equipment for realizing the method
KR100284187B1 (en) Data transmission protocol of video communication device
Chen et al. Compression algorithm for relay protection equipment data
CN109308885A (en) Method for improving signal transmission rate and display panel
CN116016943A (en) Data decoding method and device, electronic equipment and storage medium
CN117474734B (en) Existing line transformation and urban line network line and station multi-element fusion method and system
Tavakoli Entropy and image compression

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200401

Address after: 510670 Guangdong city of Guangzhou province Luogang District Science City Kexiang Road No. 11

Applicant after: China South Power Grid International Co.,Ltd.

Applicant after: NANJING GUODIAN NANZI POWER GRID AUTOMATION Co.,Ltd.

Address before: Jiangsu province Nanjing City Shuige road 211106 Jiangning economic and Technological Development Zone No. 39

Applicant before: NANJING GUODIAN NANZI POWER GRID AUTOMATION Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200110