Data compression implementation system, method and device suitable for transformer substation process layer network message, electronic equipment and storage medium
By designing a data compression system based on frequency difference analysis and coarse-grained clustering grouping in smart substations, the existing technology problems of large data volume and high computing resource consumption in substation process layer network messages are solved, and efficient data compression and Low power consumption compression effect.
Patent Information
- Application Number
- CN202410901961.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-09-20
AI Technical Summary
The data volume of smart substation process layer network messages is huge and contains redundant information. The existing Huffman compression method consumes high computing resources in embedded devices and is difficult to cope with sudden increases in high traffic.
Designed a data compression system based on frequency difference analysis and coarse-grained clustering grouping, using FPGA or ASIC chips to implement frequency statistics, frequency difference accumulation, sorting and encoding calculation circuits, optimizing the Huffman algorithm, reducing dictionary regeneration and tree Type data structure operations, reducing computing and memory resource requirements.
It improves the data compression speed, reduces system power consumption and delay, and optimizes the overall performance of the data compression system. It is suitable for substation process layer network messages under high traffic and steady-state conditions.
Smart Images

Figure CN118677958A
Abstract
Description
Technical Field
[0001] The present invention relates to a data compression implementation system, method, device, electronic equipment and storage medium suitable for substation process layer network messages, belonging to the technical field of power automation, computer and integrated circuit. Background Art
[0002] The intelligent primary and secondary devices in the smart substation use the process layer SV (Sample Value) and GOOSE (Generic Object Oriented Substation Event) specified in IEC61850 for communication, which are used to transmit analog sampling, digital data and important events of the substation. The storage and recording of process layer messages are very important for analyzing power system events, grasping dynamic conditions and monitoring the status of important power components.
[0003] The process layer SV network messages of smart substations are periodic, with data cycles ranging from 1.2kHz to 10kHz, and SV messages are generated 24 hours a day. This feature causes the amount of data in the network messages of substations to be considerable. For example, a typical power process layer network with a total bus flow of 200Mbps can have a total daily data volume of 17 megabytes, which contains a large amount of redundant and repeated information.
[0004] The messages in the substation process layer are mainly Ethernet Layer 2 SV messages. The following table shows a typical SV message example:
[0005]
[0006] The amount of network message data at the process layer of smart substations creates a huge storage pressure on embedded computer devices such as recorders, network analyzers, and data storage devices in substations. Without appropriate compression technology, the storage of process layer messages in substations will consume a large amount of storage device space, leading to a sharp increase in equipment costs and operation and maintenance costs.
[0007] At present, in order to solve the problem of limited storage space of embedded computer devices, Huffman compression method is used to compress the process layer network message of smart substation to save storage space.
[0008] However, the Huffman method involves a large number of calculations and logical operations. At the same time, due to the use of a tree data structure, it involves dynamic memory operations and requires frequent memory application or memory release operations. Embedded or pure hardware systems that implement this algorithm will consume a large amount of computing resources, logical resources, and storage resources. Substation process layer network messages are characterized by large traffic, short message cycles, and uninterrupted messages. If the existing Huffman method is used, high-performance processors or dedicated compression chips will be required, and the overall cost and power consumption of the device system will increase. In addition, in the case of a sudden increase in message traffic, the processor's compression program may not be able to cope with it.
[0009] Therefore, optimizing the Huffman method applied at the substation process layer is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0010] Purpose: In order to overcome the deficiencies in the prior art, the present invention provides a data compression implementation system, method, device, electronic device and storage medium suitable for substation process layer network messages.
[0011] Technical solution: To solve the above technical problems, the technical solution adopted by the present invention comprises the following steps:
[0012] In a first aspect, a data compression implementation system for substation process layer network messages includes: a compression integrated circuit and a large-capacity external buffer, wherein the compression integrated circuit includes: an input channel selector, wherein the output end of the input channel selector is respectively connected to the input end of a frequency counting circuit, a buffer control and an external buffer interface control circuit. The output end of the buffer control and external buffer interface control circuit is connected to the input end of the large-capacity external buffer.
[0013] The first output end of the frequency statistics circuit is connected to the divider array circuit and the frequency difference accumulator circuit in sequence, the output end of the frequency difference accumulator circuit is connected to the first input end of the frequency difference judgment circuit, the second input end of the frequency difference accumulator circuit is connected to the first output end of the current compression dictionary, and the first output end of the frequency difference judgment circuit is connected to the first input end of the frequency sorting circuit, the coarse-grained grouping clustering circuit, and the coding calculation circuit.
[0014] The second output end of the frequency statistics circuit is connected to the second input end of the frequency sorting circuit, the second output end of the frequency difference judgment circuit is connected to the first input end of the compression coding stream generation circuit, the output end of the coding calculation circuit is connected to the first input end of the current compression dictionary, the second output end of the current compression dictionary is connected to the second input end of the compression coding stream generation circuit, the output end of the large-capacity external buffer is connected to the third input end of the compression coding stream generation circuit, and the output end of the compression coding stream generation circuit is connected to the input end of the output interface control unit.
[0015] The first port of the configuration controller is connected to the second input end of the frequency difference judgment circuit, and the second port of the configuration controller is connected to the second input end of the coarse-grained grouping clustering circuit.
[0016] As a preferred solution, the compression integrated circuit adopts FPGA or ASIC chip.
[0017] As a preferred solution, the input channel selector is used to select and output a group of messages to be compressed from multiple groups of input messages to be compressed.
[0018] The frequency counting circuit includes: a comparator for 0x00 characters, a comparator for 0x01 characters, a comparator for 0x02 characters, and a comparator for 0xff characters, a total of 256 comparators, a counter for 0x00 characters, a counter for 0x01 characters, a counter for 0x02 characters, and a counter for 0xff characters, a total of 256 counters, and a total character number counter, the output end of the comparator for 0x00 characters is connected to the input end of the counter for 0x00 characters, the output end of the comparator for 0x01 characters is connected to the input end of the counter for 0x01 characters, the output end of the comparator for 0x02 characters is connected to the input end of the counter for 0x02 characters, and the output end of the comparator for 0xff characters is connected to the input end of the counter for 0xff characters. The comparator is used to output an increment signal when the character in the message to be compressed is consistent with the character corresponding to the comparator. The counter is used to output the frequency of the corresponding character. The total character count counter is used to count the frequencies of all characters in the message to be compressed.
[0019] The divider array circuit comprises: 256 dividers arranged in parallel, wherein the divider inputs the frequency of the corresponding character and the frequency of all characters, and outputs the frequency of the corresponding character.
[0020] The frequency difference accumulator circuit includes: 256 subtractors arranged in parallel, the output of the subtractor is connected to an absolute value circuit, the output ends of all absolute value circuits are connected to the input end of the adder, the subtractor inputs the frequency of the corresponding character and the frequency of the corresponding character in the current dictionary, and outputs the frequency difference of the corresponding character. The adder inputs the frequency difference of all characters and outputs the accumulated frequency difference.
[0021] The frequency difference judgment circuit includes: a comparator, the comparator is used to compare the input cumulative frequency difference with the difference threshold output by the configuration controller, if the cumulative frequency difference is less than or equal to the difference threshold, output a first work trigger signal to the compression coding stream generation circuit. If the cumulative frequency difference is greater than the difference threshold, output a second work trigger signal to the frequency sorting circuit.
[0022] The frequency sorting circuit includes: 128 comparators, 256 registers, 128 switches and a comparison result checker. The input end of each comparator sequentially traverses two adjacent and parallel registers and is connected. The output end of each switch is also connected to the two registers traversed by each comparator, and each comparator output end is connected to the enable end of each switch. Each register stores the frequency of the corresponding character. The comparator is used to compare the frequencies of the characters in the two registers. If the frequency of the character in the front register is less than the frequency of the character in the back register, the switch is activated to exchange the character in the front register with the character in the back register. When the results of all the adjacent comparators received by the comparison result checker are increasing, the sorting is terminated.
[0023] The coarse-grained grouping and clustering circuit is used to cluster the sorted original sequences of all category characters according to the first system setting parameter and the second system setting parameter output by the configuration controller to obtain a clustering array of all category characters.
[0024] The coding calculation circuit is used to assign codes to the characters in each array of all category character cluster arrays to obtain an updated dictionary, and update the current dictionary in the current compression dictionary with the updated dictionary.
[0025] The compression coding stream generating circuit is used to perform compression coding according to the first working trigger signal, the current dictionary and the message to be compressed output from the large-capacity external buffer to obtain the compressed message.
[0026] The output interface control unit is used to input the compressed message and select the output channel to output the compressed message.
[0027] As a preferred solution, it also includes: a core processor, wherein the core processor, a compression integrated circuit and a large-capacity buffer work in coordination.
[0028] In a second aspect, a data compression method applicable to a substation process layer network message specifically includes:
[0029] Step 1: Get a message to be compressed.
[0030] Step 2: Match each type of character in the message to be compressed with all types of characters in the message, and count the frequency of each type of character in the message to be compressed and the frequency of the total characters in the message to be compressed.
[0031] Step 3: Divide the frequency of each character in the message to be compressed by the frequency of the total characters in the message to be compressed to obtain the frequency of each character in the message to be compressed, subtract the frequency of each character in the message to be compressed from the frequency of the corresponding character in the current dictionary to obtain the difference, and add all the differences to obtain the cumulative frequency difference. Alternatively, if there is no current dictionary, go to step 5.
[0032] Step 4: Compare the accumulated frequency difference with the difference threshold. When the accumulated frequency difference is less than or equal to the difference threshold, use the current dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message. When the accumulated frequency difference is greater than the difference threshold, proceed to step 5.
[0033] Step 5: assign the frequency of each type of character in the message to be compressed to the character corresponding to the original sequence of all types of characters, and sort the original sequence of all types of characters in ascending order by frequency to obtain the sorted original sequence of all types of characters.
[0034] Step 6: Cluster the sorted original sequences of all category characters to obtain a clustering array of all category characters.
[0035] Step 7: Assign codes to the characters in each array of all category character clustering arrays to obtain an updated dictionary.
[0036] Step 8: Use the updated dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message.
[0037] As a preferred solution, the step 5 specifically includes:
[0038] Step 5-1: Assign the frequencies of each type of characters in the message to be compressed to the characters corresponding to the original sequence of all types of characters to obtain the original frequency sequence: , ...... .
[0039] Step 5-2: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 1 ] , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, then exit the sorting process, otherwise go to step 5-3.
[0040] Step 5-3: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 2 ] , put the large value The position of the small value is placed , while comparing and , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, the sorting process is terminated, otherwise it goes to step 5-4.
[0041] Step 5-4: Loop through steps 5-2 and 5-3 until the entire sequence is sorted in ascending order, and obtain the sorted original sequence of all category characters. .
[0042] As a preferred solution, the step 6 specifically includes:
[0043] Step 6-1: From the sorted original sequence of all category characters In Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0044]
[0045] or
[0046]
[0047] but { F i |i ∈ [ 0 , n − 1 ] } is the first set of clustered character arrays, denoted by .in, Set parameters for the first system, Set parameters for the second system.
[0048] Step 6-2: From Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0049]
[0050] or
[0051]
[0052] but { F i |i ∈ [ n , n + d − 1 ] } is the second set of clustered character arrays, denoted by .
[0053] Step 6-3: Repeat the above process until the sorted original sequence of all category characters is empty, and obtain the clustering array of all category characters, recorded as ,in, For the Group cluster character array.
[0054] As a preferred solution, the step 7 specifically includes:
[0055] Step 7.1: Get the clustered character array The number of elements in is ,calculate ,in, To round down.
[0056] Step 7.2: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ Lc indivual 0 ~ [ 011 ...... 1 ] ︸ Lc − 1 indivual 1 and the highest 0 If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.3. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0057] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the maximum The binary code of the elements is [ 00 ...... 00 ] ︸ Lc − 1 indivual 0 ~ [ 01 ..... 11 ] ︸ Highest bit 0 and Lc − 2 indivual 1 , clustering character array Remaining unassigned Move elements to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.3.
[0058] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ L c indivual 0 ~ ( 2 N C − 1 ) b ︸ L c Bits , and end the dictionary generation to obtain the updated dictionary.
[0059] Step 7.3: Get the clustered character array The number of elements in is ,calculate .
[0060] Step 7.4: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 1 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 ,in, Represents a clustered character array The final binary code length of all elements in . If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.5. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0061] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 -1 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 2 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 , clustering character array Remaining unassigned characters to move to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.5.
[0062] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ ( 2 N C − 1 ) b ︸ L c − 1 Bits [ 1 ..... 1 1 ] ︸ L c ' indivual 1 , and end the dictionary generation to obtain the updated dictionary.
[0063] Step 7.5: Repeat steps 7.1 to 7.4 until all dictionary generation is completed and an updated dictionary is obtained.
[0064] As a preferred solution, all types of characters in the message include: 0x00 characters, 0x01 characters, 0x02 characters... and 0xff characters, a total of 256 characters.
[0065] In a third aspect, a data compression device applicable to a substation process layer network message specifically comprises:
[0066] Acquisition module: used to obtain a message to be compressed.
[0067] Character frequency calculation module: used to match various characters in the message to be compressed with all categories of characters in the message, and count the frequency of various characters in the message to be compressed and the frequency of total characters in the message to be compressed.
[0068] Frequency difference calculation module: used to divide the frequency of each character in the message to be compressed by the frequency of the total characters in the message to be compressed to obtain the frequency of each character in the message to be compressed, subtract the frequency of each character in the message to be compressed from the frequency of the corresponding character in the current dictionary to obtain the difference, and add all the differences to obtain the cumulative frequency difference. Or, if there is no current dictionary, go to the sorting module.
[0069] Comparison module: used to compare the cumulative frequency difference with the difference threshold. When the cumulative frequency difference is less than or equal to the difference threshold, all characters in the compressed message are compressed and encoded using the current dictionary to obtain the compressed message. When the cumulative difference is greater than the difference threshold, it is transferred to the sorting module.
[0070] Sorting module: assign the frequency of each type of character in the message to be compressed to the character corresponding to the original sequence of all types of characters, and sort the original sequence of all types of characters in ascending order by frequency to obtain the sorted original sequence of all types of characters.
[0071] Clustering module: cluster the sorted original sequences of all category characters to obtain a clustering array of all category characters.
[0072] Dictionary generation module: assign codes to the characters in each array of all category character clustering arrays to obtain an updated dictionary.
[0073] Compression coding module: uses the updated dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message.
[0074] As a preferred solution, the sorting module specifically includes:
[0075] Step 5-1: Assign the frequencies of each type of characters in the message to be compressed to the characters corresponding to the original sequence of all types of characters to obtain the original frequency sequence: , ...... .
[0076] Step 5-2: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 1 ] , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, then exit the sorting process, otherwise go to step 5-3.
[0077] Step 5-3: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 2 ] , put the large value The position of the small value is placed , while comparing and , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, the sorting process is terminated, otherwise it goes to step 5-4.
[0078] Step 5-4: Loop through steps 5-2 and 5-3 until the entire sequence is sorted in ascending order, and obtain the sorted original sequence of all category characters. .
[0079] As a preferred solution, the clustering module specifically includes:
[0080] Step 6-1: From the sorted original sequence of all category characters In Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0081]
[0082] or
[0083]
[0084] but is the first set of clustered character arrays, denoted by .in, Set parameters for the first system, Set parameters for the second system.
[0085] Step 6-2: From Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0086]
[0087] or
[0088]
[0089] but { F i |i ∈ [ n , n + d − 1 ] } is the second set of clustered character arrays, denoted by .
[0090] Step 6-3: Repeat the above process until the sorted original sequence of all category characters is empty, and obtain the clustering array of all category characters, recorded as ,in, For the Group cluster character array.
[0091] As a preferred solution, the dictionary generation module specifically includes:
[0092] Step 7.1: Get the clustered character array The number of elements in is ,calculate ,in, To round down.
[0093] Step 7.2: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ Lc indivual 0 ~ [ 011 ...... 1 ] ︸ Lc − 1 indivual 1 and the highest 0 If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.3. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0094] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the maximum The binary code of the elements is [ 00 ...... 00 ] ︸ Lc − 1 indivual 0 ~ [ 01 ..... 11 ] ︸ Highest bit 0 and Lc − 2 indivual 1 , clustering character array Remaining unassigned Move elements to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.3.
[0095] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ L c indivual 0 ~ ( 2 N C − 1 ) b ︸ L c Bits , and end the dictionary generation to obtain the updated dictionary.
[0096] Step 7.3: Get the clustered character array The number of elements in is ,calculate .
[0097] Step 7.4: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 1 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 ,in, Represents a clustered character array The final binary code length of all elements in . If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.5. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0098] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 -1 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 2 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 , clustering character array Remaining unassigned characters to move to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.5.
[0099] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ ( 2 N C − 1 ) b ︸ L c − 1 Bits [ 1 ..... 1 1 ] ︸ L c ' indivual 1 , and end the dictionary generation to obtain the updated dictionary.
[0100] Step 7.5: Repeat steps 7.1 to 7.4 until all dictionary generation is completed and an updated dictionary is obtained.
[0101] As a preferred solution, all types of characters in the message include: 0x00 characters, 0x01 characters, 0x02 characters... and 0xff characters, a total of 256 characters.
[0102] In a fourth aspect, a computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, a data compression method applicable to a substation process layer network message as described in any one of the second aspects is implemented.
[0103] A fifth aspect, a computer device, comprising:
[0104] Memory, used to store instructions.
[0105] The processor is used to execute the instructions so that the computer device performs the operation of a data compression method applicable to substation process layer network messages as described in any one of the second aspects.
[0106] Beneficial effects: The present invention provides a data compression implementation system, method, device, electronic device and storage medium suitable for substation process layer network messages. The present invention utilizes the data characteristics of substation process layer network messages and proposes a judgment method based on frequency difference analysis, which reduces unnecessary dictionary regeneration under steady state conditions and reduces the demand for computing and memory resources. The present invention also proposes a coarse-grained clustering grouping method, which optimizes the implementation complexity of the encoding algorithm, avoids the operation of tree data structures, reduces the demand for memory bandwidth, and facilitates the algorithm mapping to the hardware system. The present invention uses a hardware field programmable circuit (FPGA) or a digital application-specific integrated circuit (ASIC) to implement data encoding and compression of messages. The present invention improves the algorithm and designs a high-performance computing circuit so that the data encoding and compression method can be efficiently mapped to the logic circuit implementation, while improving the algorithm performance, saving the system's computing resources and achieving the optimization effect of the overall system.
[0107] The present invention includes an optimization improvement based on the Huffman lossless compression algorithm, and an actual hardware accelerator system implementation of the algorithm; the improvement implementation includes dictionary establishment based on clustering grouping, encoded compression stream implementation, and dynamic feature difference detection of dictionary frequency; the system implementation includes hardware system design of the algorithm and hardware implementation of feature difference detection of dictionary tree. This technical solution can improve the data compression speed, reduce the overall power consumption of the system, and optimize the delay and bandwidth of the data compression system by utilizing the characteristics of the power process layer network message through algorithm optimization and hardware acceleration implementation.
[0108] The present invention utilizes the similar field frequency statistical characteristics of process layer network messages in a steady state to optimize the Huffman algorithm, improve system implementation, reduce the computing power and memory pressure on the system, and improve the overall performance of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0109] Figure 1 Schematic diagram of the overall structure of the data compression system.
[0110] Figure 2 This is a structural diagram of the data compression implementation system.
[0111] Figure 3 Schematic diagram for multiplex selection of data input to be compressed.
[0112] Figure 4 Schematic diagram of data input buffer and character frequency statistics.
[0113] Figure 5 For frequency statistics calculation and Schematic diagram of criterion calculation.
[0114] Figure 6 This is a schematic diagram of the comparator decision circuit.
[0115] Figure 7 This is a schematic diagram of the sorting circuit structure.
[0116] Figure 8 Schematic diagram of state one of the sorting circuit.
[0117] Fig. 9 Schematic diagram of the sorting circuit state 2.
[0118] Fig.10 Schematic diagram of the structure of coarse-grained grouping clustering.
[0119] Fig.11 A schematic diagram of the situation where there are subsequent clustering groups for group coding.
[0120] Fig.12 Schematic diagram of the second situation where there are subsequent clustering groups for group coding.
[0121] Fig.13 Schematic diagram of the situation where there is no subsequent cluster group for group coding.
[0122] Fig.14 Schematic diagram of the circuit for encoding calculation assignment.
[0123] Fig.15 Generate a circuit schematic for compression flow. DETAILED DESCRIPTION
[0124] The following is a clear and complete description of the technical solutions in the examples of the present invention in conjunction with the accompanying drawings in the examples 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 those skilled in the art without creative work are within the protection scope of the present invention.
[0125] The present invention will be further described below in conjunction with specific embodiments.
[0126] Embodiment 1:
[0127] This embodiment introduces a data compression implementation system suitable for substation process layer network messages, such as Figure 1 As shown, it includes: a compression integrated circuit and a large-capacity external buffer. An FPGA or ASIC chip is used as the compression integrated circuit, which cooperates with an external large-capacity external buffer. It supports the use of a multiplexer to select different data to be compressed, and supports multiple compressed data outputs.
[0128] The compression integrated circuit comprises: an input channel selector, the output end of the input channel selector is respectively connected to the input end of the frequency counting circuit, the cache control and external cache interface control circuit. The output end of the cache control and external cache interface control circuit is connected to the input end of the large-capacity external cache.
[0129] The first output end of the frequency statistics circuit is connected to the divider array circuit and the frequency difference accumulator circuit in sequence, the output end of the frequency difference accumulator circuit is connected to the first input end of the frequency difference judgment circuit, the second input end of the frequency difference accumulator circuit is connected to the first output end of the current compression dictionary, and the first output end of the frequency difference judgment circuit is connected to the first input end of the frequency sorting circuit, the coarse-grained grouping clustering circuit, and the coding calculation circuit.
[0130] The second output end of the frequency statistics circuit is connected to the second input end of the frequency sorting circuit, the second output end of the frequency difference judgment circuit is connected to the first input end of the compression coding stream generation circuit, the output end of the coding calculation circuit is connected to the first input end of the current compression dictionary, the second output end of the current compression dictionary is connected to the second input end of the compression coding stream generation circuit, the output end of the large-capacity external buffer is connected to the third input end of the compression coding stream generation circuit, and the output end of the compression coding stream generation circuit is connected to the input end of the output interface control unit.
[0131] The first port of the configuration controller is connected to the second input end of the frequency difference judgment circuit, and the second port of the configuration controller is connected to the second input end of the coarse-grained grouping clustering circuit.
[0132] The input channel selector is used to select and output a group of messages to be compressed from multiple groups of input messages to be compressed.
[0133] The frequency counting circuit includes: a comparator for 0x00 characters, a comparator for 0x01 characters, a comparator for 0x02 characters, and a comparator for 0xff characters, a total of 256 comparators, a counter for 0x00 characters, a counter for 0x01 characters, a counter for 0x02 characters, and a counter for 0xff characters, a total of 256 counters, and a total character number counter, the output end of the comparator for 0x00 characters is connected to the input end of the counter for 0x00 characters, the output end of the comparator for 0x01 characters is connected to the input end of the counter for 0x01 characters, the output end of the comparator for 0x02 characters is connected to the input end of the counter for 0x02 characters, and the output end of the comparator for 0xff characters is connected to the input end of the counter for 0xff characters. The comparator is used to output an increment signal when the character in the message to be compressed is consistent with the character corresponding to the comparator. The counter is used to output the frequency of the corresponding character. The total character count counter is used to count the frequencies of all characters in the message to be compressed.
[0134] The divider array circuit comprises: 256 dividers arranged in parallel, wherein the divider inputs the frequency of the corresponding character and the frequency of all characters, and outputs the frequency of the corresponding character.
[0135] The frequency difference accumulator circuit includes: 256 subtractors arranged in parallel, the output of the subtractor is connected to an absolute value circuit, the output ends of all absolute value circuits are connected to the input end of the adder, the subtractor inputs the frequency of the corresponding character and the frequency of the corresponding character in the current dictionary, and outputs the frequency difference of the corresponding character. The adder inputs the frequency difference of all characters and outputs the accumulated frequency difference.
[0136] The frequency difference judgment circuit includes: a comparator, the comparator is used to compare the input cumulative frequency difference with the difference threshold output by the configuration controller, if the cumulative frequency difference is less than or equal to the difference threshold, output a first work trigger signal to the compression coding stream generation circuit. If the cumulative frequency difference is greater than the difference threshold, output a second work trigger signal to the frequency sorting circuit.
[0137] The frequency sorting circuit includes: 128 comparators, 256 registers, 128 switches and a comparison result checker. The input end of each comparator sequentially traverses two adjacent and parallel registers and is connected. The output end of each switch is also connected to the two registers traversed by each comparator, and each comparator output end is connected to the enable end of each switch. Each register stores the frequency of the corresponding character. The comparator is used to compare the frequencies of the characters in the two registers. If the frequency of the character in the front register is less than the frequency of the character in the back register, the switch is activated to exchange the character in the front register with the character in the back register. When the results of all the adjacent comparators received by the comparison result checker are increasing, the sorting is terminated.
[0138] The coarse-grained grouping and clustering circuit is used to cluster the sorted original sequences of all category characters according to the first system setting parameter and the second system setting parameter output by the configuration controller to obtain a clustering array of all category characters.
[0139] The coding calculation circuit is used to assign codes to the characters in each array of all category character cluster arrays to obtain an updated dictionary, and update the current dictionary in the current compression dictionary with the updated dictionary.
[0140] The compression coding stream generating circuit is used to perform compression coding according to the first working trigger signal, the current dictionary and the message to be compressed output from the large-capacity external buffer to obtain the compressed message.
[0141] The output interface control unit is used to input the compressed message and select the output channel to output the compressed message.
[0142] A data compression implementation system for substation process layer network messages, when used, also includes: a core processor, such as Figure 2 As shown, the core processor, compression integrated circuit and large-capacity buffer use FPGA or ASIC chip as the compression integrated circuit, cooperate with external large-capacity buffer and external processor to work together, support the use of multiplexers to select different data to be compressed, and support multiple compressed data outputs.
[0143] Embodiment 2:
[0144] This embodiment introduces a data compression method applicable to a substation process layer network message, specifically including:
[0145] Step 1: Get a message to be compressed.
[0146] Step 2: Match each type of character in the message to be compressed with all types of characters in the message, and count the frequency of each type of character in the message to be compressed and the frequency of the total characters in the message to be compressed.
[0147] Step 3: Divide the frequency of each character in the message to be compressed by the frequency of the total characters in the message to be compressed to obtain the frequency of each character in the message to be compressed, subtract the frequency of each character in the message to be compressed from the frequency of the corresponding character in the current dictionary to obtain the difference, and add all the differences to obtain the cumulative frequency difference. Alternatively, if there is no current dictionary, go to step 5.
[0148] Step 4: Compare the accumulated frequency difference with the difference threshold. When the accumulated frequency difference is less than or equal to the difference threshold, use the current dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message. When the accumulated frequency difference is greater than the difference threshold, proceed to step 5.
[0149] Step 5: assign the frequency of each type of character in the message to be compressed to the character corresponding to the original sequence of all types of characters, and sort the original sequence of all types of characters in ascending order by frequency to obtain the sorted original sequence of all types of characters.
[0150] Step 6: Cluster the sorted original sequences of all category characters to obtain a clustering array of all category characters.
[0151] Step 7: Assign codes to the characters in each array of all category character clustering arrays to obtain an updated dictionary.
[0152] Step 8: Use the updated dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message.
[0153] Furthermore, the step 5 specifically includes:
[0154] Step 5-1: Assign the frequencies of each type of characters in the message to be compressed to the characters corresponding to the original sequence of all types of characters to obtain the original frequency sequence: , ...... .
[0155] Step 5-2: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 1 ] , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, then exit the sorting process, otherwise go to step 5-3.
[0156] Step 5-3: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 2 ] , put the large value The position of the small value is placed , while comparing and , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, the sorting process is terminated, otherwise it goes to step 5-4.
[0157] Step 5-4: Loop through steps 5-2 and 5-3 until the entire sequence is sorted in ascending order, and obtain the sorted original sequence of all category characters. .
[0158] Furthermore, the step 6 specifically includes:
[0159] Step 6-1: From the sorted original sequence of all category characters In Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0160]
[0161] or
[0162]
[0163] but { F i |i ∈ [ 0 , n − 1 ] } is the first set of clustered character arrays, denoted by .in, Set parameters for the first system, Set parameters for the second system.
[0164] Step 6-2: From Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0165]
[0166] or
[0167]
[0168] but { F i |i ∈ [ n , n + d − 1 ] } is the second set of clustered character arrays, denoted by .
[0169] Step 6-3: Repeat the above process until the sorted original sequence of all category characters is empty, and obtain the clustering array of all category characters, recorded as ,in, For the Group cluster character array.
[0170] Furthermore, the step 7 specifically includes:
[0171] Step 7.1: Get the clustered character array The number of elements in is ,calculate ,in, To round down.
[0172] Step 7.2: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ Lc indivual 0 ~ [ 011 ...... 1 ] ︸ Lc − 1 indivual 1 and the highest 0 If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.3. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0173] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the maximum The binary code of the elements is [ 00 ...... 00 ] ︸ Lc − 1 indivual 0 ~ [ 01 ..... 11 ] ︸ Highest bit 0 and Lc − 2 indivual 1 , clustering character array Remaining unassigned Move elements to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.3.
[0174] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ L c indivual 0 ~ ( 2 N C − 1 ) b ︸ L c Bits , and end the dictionary generation to obtain the updated dictionary.
[0175] Step 7.3: Get the clustered character array The number of elements in is ,calculate .
[0176] Step 7.4: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 1 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 ,in, Represents a clustered character array The final binary code length of all elements in . If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.5. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0177] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 -1 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 2 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 , clustering character array Remaining unassigned characters to move to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.5.
[0178] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ ( 2 N C − 1 ) b ︸ L c − 1 Bits [ 1 ..... 1 1 ] ︸ L c ' indivual 1 , and end the dictionary generation to obtain the updated dictionary.
[0179] Step 7.5: Repeat steps 7.1 to 7.4 until all dictionary generation is completed and an updated dictionary is obtained.
[0180] Furthermore, all categories of characters in the message include: 0x00 characters, 0x01 characters, 0x02 characters... and 0xff characters, a total of 256 characters.
[0181] Embodiment 3:
[0182] This embodiment introduces a data compression device applicable to a substation process layer network message, specifically comprising:
[0183] Acquisition module: used to obtain a message to be compressed.
[0184] Character frequency calculation module: used to match various characters in the message to be compressed with all categories of characters in the message, and count the frequency of various characters in the message to be compressed and the frequency of total characters in the message to be compressed.
[0185] Frequency difference calculation module: used to divide the frequency of each character in the message to be compressed by the frequency of the total characters in the message to be compressed to obtain the frequency of each character in the message to be compressed, subtract the frequency of each character in the message to be compressed from the frequency of the corresponding character in the current dictionary to obtain the difference, and add all the differences to obtain the cumulative frequency difference. Or, if there is no current dictionary, go to the sorting module.
[0186] Comparison module: used to compare the cumulative frequency difference with the difference threshold. When the cumulative frequency difference is less than or equal to the difference threshold, all characters in the compressed message are compressed and encoded using the current dictionary to obtain the compressed message. When the cumulative difference is greater than the difference threshold, it is transferred to the sorting module.
[0187] Sorting module: assign the frequency of each type of character in the message to be compressed to the character corresponding to the original sequence of all types of characters, and sort the original sequence of all types of characters in ascending order by frequency to obtain the sorted original sequence of all types of characters.
[0188] Clustering module: cluster the sorted original sequences of all category characters to obtain a clustering array of all category characters.
[0189] Dictionary generation module: assign codes to the characters in each array of all category character clustering arrays to obtain an updated dictionary.
[0190] Compression coding module: uses the updated dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message.
[0191] Furthermore, the sorting module specifically includes:
[0192] Step 5-1: Assign the frequencies of each type of characters in the message to be compressed to the characters corresponding to the original sequence of all types of characters to obtain the original frequency sequence: , ...... .
[0193] Step 5-2: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 1 ] , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, then exit the sorting process, otherwise go to step 5-3.
[0194] Step 5-3: Make a pair and For comparison, i ∈ [ 0 ,N / 2 − 2 ] , put the large value The position of the small value is placed , while comparing and , put the large value The position of the small value is placed If it is detected that the entire sequence has increased, the sorting process is terminated, otherwise it goes to step 5-4.
[0195] Step 5-4: Loop through steps 5-2 and 5-3 until the entire sequence is sorted in ascending order, and obtain the sorted original sequence of all category characters. .
[0196] Furthermore, the clustering module specifically includes:
[0197] Step 6-1: From the sorted original sequence of all category characters In Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0198]
[0199] or
[0200]
[0201] but { F i |i ∈ [ 0 , n − 1 ] } is the first set of clustered character arrays, denoted by .in, Set parameters for the first system, Set parameters for the second system.
[0202] Step 6-2: From Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0203]
[0204] or
[0205]
[0206] but { F i |i ∈ [ n , n + d − 1 ] } is the second set of clustered character arrays, denoted by .
[0207] Step 6-3: Repeat the above process until the sorted original sequence of all category characters is empty, and obtain the clustering array of all category characters, recorded as ,in, For the Group cluster character array.
[0208] Furthermore, the dictionary generation module specifically includes:
[0209] Step 7.1: Get the clustered character array The number of elements in is ,calculate ,in, To round down.
[0210] Step 7.2: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ Lc indivual 0 ~ [ 011 ...... 1 ] ︸ Lc − 1 indivual 1 and the highest 0 If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.3. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0211] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the maximum The binary code of the elements is [ 00 ...... 00 ] ︸ Lc − 1 indivual 0 ~ [ 01 ..... 11 ] ︸ Highest bit 0 and Lc − 2 indivual 1 , clustering character array Remaining unassigned Move elements to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.3.
[0212] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ] ︸ L c indivual 0 ~ ( 2 N C − 1 ) b ︸ L c Bits , and end the dictionary generation to obtain the updated dictionary.
[0213] Step 7.3: Get the clustered character array The number of elements in is ,calculate .
[0214] Step 7.4: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 1 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 ,in, Represents a clustered character array The final binary code length of all elements in . If there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.5. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained.
[0215] Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the encoding, and all elements occupy the binary code [ 0 0 ...... 00 ︸ L c − 1 -1 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 2 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 , clustering character array Remaining unassigned characters to move to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.5.
[0216] Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code [ 00 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ ( 2 N C − 1 ) b ︸ L c − 1 Bits [ 1 ..... 1 1 ] ︸ L c ' indivual 1 , and end the dictionary generation to obtain the updated dictionary.
[0217] Step 7.5: Repeat steps 7.1 to 7.4 until all dictionary generation is completed and an updated dictionary is obtained.
[0218] Furthermore, all categories of characters in the message include: 0x00 characters, 0x01 characters, 0x02 characters... and 0xff characters, a total of 256 characters.
[0219] Embodiment 4:
[0220] A computer-readable storage medium stores a computer program thereon. When the computer program is executed by a processor, a data compression method applicable to a substation process layer network message as described in any one of Embodiment 2 is implemented.
[0221] Embodiment 5:
[0222] A computer device comprising:
[0223] Memory, used to store instructions.
[0224] The processor is used to execute the instructions so that the computer device performs the operation of a data compression method applicable to substation process layer network messages as described in any one of Example 2.
[0225] Embodiment 6:
[0226] This embodiment introduces a working method of a data compression implementation system applicable to a substation process layer network message, specifically including:
[0227] Step (1), receiving the input message to be compressed through the multiplexer, using the data selection register to determine which one of the messages to be compressed is used, and caching the message to be compressed into an external large-capacity cache. The multiplexer selection diagram is shown in FIG. Figure 3 shown.
[0228] While caching the message in step (1), a large-scale counter circuit is used to count the frequency of characters in the message to be compressed. The counter unit of each character monitors whether the input message to be compressed matches its own character. If the input character matches, the counter is incremented by one.
[0229] Step (1) and step (2) work in parallel when character data is input.
[0230] After step (3) and cache statistics are completed, if there is no previous compression dictionary, jump to step (6); otherwise, run step (3) and uniformly use parallel dividers to solve the frequency of each character of the current input message to be compressed based on the frequency of each character and the total number of characters.
[0231] Step (4), then solve the problem through parallel subtractors and parallel adders .
[0232] P diff = ∑ i = 0 N − 1 |( f c [ i ] − f d [ i ])|
[0233] Represents the frequency statistics of the current input message to be compressed. Represents the frequency statistics of the current dictionary data, Represents the number of character types in the input data, calculated by summing up the absolute values of the differences.
[0234] The implementation structure of step (3) and step (4) is as follows: Figure 4-5 As shown, ( Through the array of large-scale dividers, subtractors and absolute value circuits, the frequency difference between the current data and the dictionary data of each character can be quickly calculated in parallel. Then, through a 256-input high-speed adder, the frequency difference between the current data and the dictionary data of each character can be quickly calculated. .
[0235] Step (5): The threshold value set by the system A comparison is performed to determine the choice of dictionary.
[0236] when When , bypass the frequency sorting unit and dictionary generation unit, and directly use the current compression dictionary to compress and encode the data. Jump to step (8).
[0237] when When the frequency statistics cache is completed, the frequency statistics cache that has been completed is output, and the frequency sorting unit is triggered to generate a normal dictionary. At the same time, the frequency statistics cache of the current dictionary used by the frequency statistics module needs to be updated for the frequency feature comparison of subsequent messages. Jump to step (6).
[0238] Manual settings are performed according to actual needs. When the value is set to a smaller value, a better compression rate can be achieved, but it will frequently trigger the repeated creation of dictionaries, affecting the flow and latency performance. When the setting is larger, the latency and flow can be optimized, but the compression rate will be sacrificed.
[0239] Step (5) Design of decision circuit: Figure 6 , using a comparator circuit to compare and , and choose to trigger step (9) or step (6) based on the result.
[0240] Step (6) receives the character sequence that has been counted in step (5) and sorts the frequency by hardware circuit. The sorting process is as follows:
[0241] The original frequency sequence is , ...... , we need to sort the sequence in ascending order, we reuse A comparator is used to sort the data, and a comparison result checker is set. The comparison result checker monitors the size of all two adjacent data units. If all two adjacent units are increasing, the sequence sorting is completed, that is:
[0242]
[0243] Comp all = { 1 , when Comp i (F i, F i + 1 ) = 1 ,i ∈ [ 0 ,N- 1 ] 0 ,else
[0244] 1) Make a comparison and For comparison ( i ∈ [ 0 ,N / 2 − 1 ] ), large value is put into The position of the small value is placed If the comparison result checker detects that the entire sequence has increased, the sorting process will be exited.
[0245] 2) Make a comparison and For comparison ( i ∈ [ 0 ,N / 2 − 2 ] ), large value is put into The position of the small value is placed . Compare and , put the large value The position of the small value is placed If the comparison result checker detects that the entire sequence has increased, the sorting process is terminated.
[0246] Repeat steps 1) and 2) until the entire sequence is sorted in ascending order.
[0247] Finally, we get the sorted frequency sequence:
[0248]
[0249] The circuit design of this step is as follows Figure 7 As shown, it is composed of a large-scale comparator and switch group, a control and sorting result detection unit, and a frequency statistics register. The frequency statistics register will first receive the frequency data that has been completed before. The control and sorting detection unit completes the scheduling allocation of the comparator and switch group and the detection of the final sorting result. There are two allocation states of the comparator pre-switch group, such as Figure 8 and Fig. 9 , which correspond to the comparison states of (1) and (2) in this step respectively. The comparator determines whether the switch needs to exchange the corresponding two registers based on the comparison result. After the statistics are completed, the sorting result of the frequency statistics register is output to step (7).
[0250] Step (7) receives the frequency sequence that has been sorted in ascending order, such as Fig.10 As shown in the figure, a coarse-grained clustering method is used to group the frequencies of each character. The specific method is as follows
[0251] The unit obtains the sorted frequency sequence
[0252]
[0253] 1) From Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0254]
[0255] or
[0256]
[0257] It is believed that { F i |i ∈ [ 0 , n − 1 ] } is the first group of cluster character arrays. The first condition ensures that the absolute maximum distance within the cluster is prioritized, and the second condition ensures that when there is a large change in adjacent frequencies, they can be identified as different cluster groups. This group is recorded as .
[0258] 2) From Start scanning the subsequent sequence, and when one of the units is found Meet one of the following conditions
[0259]
[0260] or
[0261]
[0262] It is believed that { F i |i ∈ [ n , n + d − 1 ] } is the second set of clustered character arrays, denoted by .
[0263] and Set parameters for the system. , which can be set according to actual needs and the total frequency of compressed data.
[0264] Repeat the above process until the sequence is empty, and we obtain a series of clustered character arrays, recorded as
[0265]
[0266] Total There are clustered character arrays, and the frequencies of the characters in each clustered character array are relatively concentrated, and the frequencies show an increasing trend.
[0267] Step (8) performs dictionary assignment for each character according to the grouped character cluster groups and the principle of "characters in the same classification group are assigned compression codes of the same length; character groups with high frequency are assigned codes with shorter lengths, and character groups with low frequency are assigned codes with longer lengths". The specific algorithm is as follows:
[0268] 1) First check the cluster group with the largest frequency , the number of elements inside is ,calculate . Check the following two situations:
[0269] A. If , indicating that the number of character types in this group just occupies The length of the binary code, and there is a binary code left for the subsequent clustering group, then the clustering group Give Length The binary code dictionary, occupying the binary code [ 00 ...... 00 ] ︸ Lc indivual 0 ~ [ 011 ...... 1 ] ︸ Lc − 1 indivual 1 and the highest 0 If there is a next cluster group ,but The lowest binary code of the characters in the group If all the bits of the bit are 1, otherwise the dictionary generation ends. Fig.11 .
[0270] B. If , indicating that the number of elements in this group is insufficient to fill The binary code of the length, but The length of the binary code cannot completely group the clusters To generate a dictionary, we need to consider two cases:
[0271] a. If there are subsequent clustering groups , then the cluster group The largest characters to give the length The binary code of [ 00 ...... 00 ] ︸ Lc − 1 indivual 0 ~ [ 01 ..... 11 ] ︸ Highest bit 0 and Lc − 2 indivual 1 , cluster group Remaining unassigned characters to move to the next cluster group , and the next cluster group The lowest code in the group All bits are 1. Fig.12 .
[0272] b. If there is no subsequent cluster group , then the cluster group Give Length The binary code of [ 00 ...... 00 ] ︸ L c indivual 0 ~ ( 2 N C − 1 ) b ︸ L c Bits , and the dictionary generation ends. Fig.13 .
[0273] After the dictionary generation is completed, the final encoding length of the group is recorded. .
[0274] 2) Then check the frequency of the second cluster group , the number of elements inside is Note that the number includes the possible decentralization in step 1 characters, count , check the following two situations:
[0275] A. If , indicating that the number of character types in this group just occupies The length of the binary code, and there is a binary code left for the subsequent clustering group, then the clustering group Give Length The binary code of [ 0 0 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 1 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 , if there is a next cluster group , the next cluster group The lowest code in the group If all bits are 1, the encoding is terminated otherwise.
[0276] B. If , indicating that the number of elements in this group is insufficient to fill The binary encoding of the length, but The length of the binary code cannot completely group the clusters To generate a dictionary, we need to consider two cases:
[0277] a. If there are subsequent clustering groups , then the cluster group The largest characters to give the length The binary code occupies the code [ 0 0 ...... 00 ︸ L c − 1 -1 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ [ 0 1 ...... 1 ︸ Highest bit 0 and L c − 1 - 2 indivual 1 1 ..... 1 1 ] ︸ L c ' indivual 1 , cluster group Remaining unassigned characters to move to the next cluster group , and the next cluster group The lowest code in the group All bits are 1.
[0278] b. If there is no subsequent cluster group , then the cluster group Give Length The binary code of [ 00 ...... 00 ︸ L c − 1 indivual 0 1 ..... 1 1 ] ︸ L c ' indivual 1 ~ ( 2 N C − 1 ) b ︸ L c − 1 Bits [ 1 ..... 1 1 ] ︸ L c ' indivual 1 , and end dictionary generation.
[0279] Repeat the above process until all character dictionaries are generated.
[0280] like Fig.14 , this figure implements the dictionary generation of step (8). The core dictionary calculation unit uses the sorted frequency cache and the grouping boundary and length results of step (7) to implement the algorithm described in step (8) and finally generates a new dictionary code
[0281] Step (9) If the process proceeds from step (8) to step (9), the compression dictionary generated in step (8) is used (representing that a new dictionary is needed to be used to encode and replace the data in the external large-capacity buffer; if the process proceeds from step (5) to step (9), the current compression dictionary is used (representing that the old dictionary is used) to encode and replace the data in the external large-capacity buffer to generate a compressed code stream, and the compression dictionary updating unit updates the current compression dictionary with the newly generated compression dictionary.
[0282] Step (10) pushes the compressed code stream and compression dictionary to the external target system as required.
[0283] like Fig.15Implement the logic of step (9) and step (10). The buffer read control unit reads the data to be compressed from the external large-capacity buffer, and the core compression stream replacement generation unit uses the target dictionary according to the requirements to replace the characters of the data to be compressed, compresses the data and outputs it to the buffer; the output interface control unit outputs the compressed data in the buffer to the target output channel.
[0284] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0285] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0286] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0287] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0288] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A data compression implementation system for substation process layer network messages, characterized in that: include: A compression integrated circuit and a large-capacity external buffer, the compression integrated circuit comprising: an input channel selector, the output end of the input channel selector is respectively connected to the input end of the frequency counting circuit, the buffer control and external buffer interface control circuit; the output end of the buffer control and external buffer interface control circuit is connected to the input end of the large-capacity external buffer; The first output end of the frequency counting circuit is connected to the divider array circuit and the frequency difference accumulator circuit in sequence, the output end of the frequency difference accumulator circuit is connected to the first input end of the frequency difference judgment circuit, the second input end of the frequency difference accumulator circuit is connected to the first output end of the current compression dictionary, and the first output end of the frequency difference judgment circuit is connected to the first input end of the frequency sorting circuit, the coarse-grained grouping clustering circuit, and the coding calculation circuit; The second output end of the frequency counting circuit is connected to the second input end of the frequency sorting circuit, the second output end of the frequency difference judgment circuit is connected to the first input end of the compression code stream generation circuit, the output end of the coding calculation circuit is connected to the first input end of the current compression dictionary, the second output end of the current compression dictionary is connected to the second input end of the compression code stream generation circuit, the output end of the large-capacity external buffer is connected to the third input end of the compression code stream generation circuit, and the output end of the compression code stream generation circuit is connected to the input end of the output interface control unit; The first port of the configuration controller is connected to the second input end of the frequency difference judgment circuit, and the second port of the configuration controller is connected to the second input end of the coarse-grained grouping clustering circuit.
2. A data compression implementation system for substation process layer network messages according to claim 1, characterized in that: The compression integrated circuit adopts FPGA or ASIC chip.
3. A data compression implementation system for substation process layer network messages according to claim 1, characterized in that: The input channel selector is used to select and output a group of messages to be compressed from the input multiple groups of messages to be compressed; The frequency counting circuit comprises: a comparator for 0x00 characters, a comparator for 0x01 characters, a comparator for 0x02 characters ... and a comparator for 0xff characters, a total of 256 comparators, a counter for 0x00 characters, a counter for 0x01 characters, a counter for 0x02 characters ... and a counter for 0xff characters, a total of 256 counters, and a total character number counter, wherein the output end of the comparator for 0x00 characters is connected to the input end of the counter for 0x00 characters, and the comparator for 0x01 characters is connected to the input end of the counter for 0x02 characters. The output end of the comparator is connected to the input end of the counter of the 0x01 character, the output end of the comparator of the 0x02 character is connected to the input end of the counter of the 0x02 character... and the output end of the comparator of the 0xff character is connected to the input end of the counter of the 0xff character; the comparator is used to output an increment signal when the character in the message to be compressed is consistent with the character corresponding to the comparator; the counter is used to output the frequency of the corresponding character; the total character number counter is used to count the frequencies of all characters in the message to be compressed; The divider array circuit comprises: 256 dividers arranged in parallel, the dividers input the frequency of the corresponding character and the frequency of all characters, and output the frequency of the corresponding character; The frequency difference accumulator circuit comprises: 256 subtractors arranged in parallel, the outputs of the subtractors are connected to absolute value circuits, the outputs of all absolute value circuits are connected to the inputs of the adders, the subtractors input the frequency of the corresponding character and the frequency of the corresponding character in the current dictionary, and output the frequency difference of the corresponding character; the adders input the frequency difference of all characters, and output the accumulated frequency difference; The frequency difference judgment circuit includes: a comparator, the comparator is used to compare the input cumulative frequency difference with the difference threshold output by the configuration controller, if the cumulative frequency difference is less than or equal to the difference threshold, output a first working trigger signal to the compression coding stream generation circuit; if the cumulative frequency difference is greater than the difference threshold, output a second working trigger signal to the frequency sorting circuit; The frequency sorting circuit comprises: 128 comparators, 256 registers, 128 switches and a comparison result checker, wherein the input end of each comparator sequentially traverses two adjacent and parallelly arranged registers and is connected, the output end of each switch is also connected to the two registers traversed by each comparator, and the output end of each comparator is connected to the enable end of each switch; each register stores the frequency of the corresponding character, and the comparator is used to compare the frequencies of the characters in the two registers. If the frequency of the character in the front register is less than the frequency of the character in the back register, the switch is activated to exchange the character in the front register with the character in the back register. When the results of all the adjacent comparators received by the comparison result checker are all increasing, the sorting is terminated; The coarse-grained grouping and clustering circuit is used to cluster the sorted original sequences of all category characters according to the first system setting parameter and the second system setting parameter output by the configuration controller to obtain a clustering array of all category characters; The coding calculation circuit is used to assign codes to the characters in each array of all category character cluster arrays to obtain an updated dictionary, and update the current dictionary in the current compression dictionary with the updated dictionary; The compression coding stream generating circuit is used to perform compression coding according to the first working trigger signal, the current dictionary and the message to be compressed output from the large-capacity external buffer to obtain the compressed message; The output interface control unit is used to input the compressed message and select the output channel to output the compressed message.
4. A data compression method for substation process layer network messages, characterized in that: Specifically include: Step 1: Get a message to be compressed; Step 2: Match each type of character in the message to be compressed with all types of characters in the message, and count the frequency of each type of character in the message to be compressed and the frequency of the total characters in the message to be compressed; Step 3: Divide the frequency of each character in the message to be compressed by the frequency of the total characters in the message to be compressed to obtain the frequency of each character in the message to be compressed, subtract the absolute value of the frequency of each character in the message to be compressed from the frequency of the corresponding character in the current dictionary to obtain the difference, and add all the differences to obtain the cumulative frequency difference; Or, if there is no current dictionary, go to step 5; Step 4: Compare the cumulative frequency difference with the difference threshold. When the cumulative frequency difference is less than or equal to the difference threshold, use the current dictionary to compress and encode all characters in the message to be compressed to obtain a compressed message. When the cumulative difference is greater than the difference threshold, proceed to step 5; Step 5: assign the frequencies of each type of character in the message to be compressed to the characters corresponding to the original sequences of all types of characters, and sort the original sequences of all types of characters in ascending order by frequency to obtain sorted original sequences of all types of characters; Step 6: Cluster the sorted original sequences of all category characters to obtain a cluster array of all category characters; Step 7: Assign codes to the characters in each array of all category character clustering arrays to obtain an updated dictionary; Step 8: Use the updated dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message.
5. A data compression method applicable to substation process layer network messages according to claim 4, characterized in that: The step 5 specifically includes: Step 5-1: Assign the frequencies of each type of characters in the message to be compressed to the characters corresponding to the original sequence of all types of characters to obtain the original frequency sequence: , ...... ; Step 5-2: Make a pair and For comparison, , put the large value The position of the small value is placed If the whole sequence is detected to be increasing, then exit the sorting process, otherwise go to step 5-3; Step 5-3: Make a pair and For comparison, , put the large value The position of the small value is placed , while comparing and , put the large value The position of the small value is placed If the whole sequence is detected to be increasing, the sorting process is terminated, otherwise, step 5-4 is entered; Step 5-4: Loop through steps 5-2 and 5-3 until the entire sequence is sorted in ascending order, and obtain the sorted original sequence of all category characters. .
6. A data compression method applicable to substation process layer network messages according to claim 4, characterized in that: The step 6 specifically includes: Step 6-1: From the sorted original sequence of all category characters In Start scanning the subsequent sequence, and when one of the units is found One of the following conditions is met: ; or, ; but is the first set of clustered character arrays, denoted by ;in, Set parameters for the first system, Setting parameters for the second system; Step 6-2: From Start scanning the subsequent sequence, and when one of the units is found One of the following conditions is met: ; or, ; but is the second set of clustered character arrays, denoted by ; Step 6-3: Repeat the above process until the sorted original sequence of all category characters is empty, and obtain the clustering array of all category characters, recorded as ,in, For the Group cluster character array.
7. A data compression method applicable to substation process layer network messages according to claim 4, characterized in that: The step 7 specifically includes: Step 7.1: Get the clustered character array The number of elements in is ,calculate ,in, To round down; Step 7.2: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code ; If the next cluster character array exists ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.
3. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained; Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the maximum The binary code of the elements is , clustering character array Remaining unassigned Move elements to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1 and go to step 7.3; Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code , and end the dictionary generation to obtain the updated dictionary; Step 7.3: Get the clustered character array The number of elements in is ,calculate ; Step 7.4: If , then the cluster character array All elements in the The binary code is assigned to the encoding, and all elements occupy the binary code ,in, Represents a clustered character array The final binary code length of all elements in; if there is a next cluster character array ,but The lowest binary code of the characters in the group The bits of the bit are all 1, and go to step 7.
5. If there is no next cluster character array , then the dictionary generation ends and the updated dictionary is obtained; Or if , and there is a subsequent clustering character array , then the cluster character array The largest elements give length The binary code is assigned to the encoding, and all elements occupy the binary code , clustering character array Remaining unassigned characters to move to the next cluster character array , and the next cluster character array The lowest binary code of the characters in the group All bits are 1, and go to step 7.5; Or if , and there is no subsequent clustering character array , then the cluster character array Give Length The binary code is assigned to the encoding, and all elements occupy the binary code , and end the dictionary generation to obtain the updated dictionary; Step 7.5: Repeat steps 7.1 to 7.4 until all dictionary generation is completed and an updated dictionary is obtained.
8. A data compression device for substation process layer network messages, characterized in that: Specifically include: Acquisition module: used to obtain a message to be compressed; Character frequency calculation module: used to match various characters in the message to be compressed with all characters of the message, and count the frequency of various characters in the message to be compressed and the frequency of the total characters in the message to be compressed; Frequency difference calculation module: used for dividing the frequency of each character in the message to be compressed by the frequency of the total characters in the message to be compressed to obtain the frequency of each character in the message to be compressed, subtracting the frequency of each character in the message to be compressed from the frequency of the corresponding character in the current dictionary to obtain the difference, and adding all the differences to obtain the cumulative frequency difference; Or, if there is no current dictionary, go to the sorting module; Comparison module: used to compare the cumulative frequency difference with the difference threshold. When the cumulative frequency difference is less than or equal to the difference threshold, all characters in the compressed message are compressed and encoded using the current dictionary to obtain the compressed message. When the cumulative difference is greater than the difference threshold, it is transferred to the sorting module; Sorting module: assign the frequency of each type of character in the message to be compressed to the character corresponding to the original sequence of all types of characters, and sort the original sequence of all types of characters in ascending order according to the frequency to obtain the sorted original sequence of all types of characters; Clustering module: cluster the sorted original sequences of all category characters to obtain the cluster array of all category characters; Dictionary generation module: assign codes to the characters in each array of all category character cluster arrays to obtain an updated dictionary; Compression coding module: uses the updated dictionary to compress and encode all characters in the message to be compressed to obtain the compressed message.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, a data compression method applicable to a substation process layer network message as described in any one of claims 4 to 7 is implemented.
10. A computer device, characterized in that: include: A memory for storing instructions; The processor is used to execute the instructions so that the computer device performs the operation of the data compression method applicable to the substation process layer network message as described in any one of claims 4 to 7.
