Data encoding and decoding method and device for service information interaction of power regulation and control application
By employing the varfloat algorithm and variable-length compressed encoding of integer data in the power control system, combined with a dedicated message description language and programming language function overloading, the problems of insufficient data transmission efficiency and security in existing technologies have been solved, achieving efficient and secure data interaction.
Patent Information
- Application Number
- CN202511380505.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2026-02-03
AI Technical Summary
Existing data encoding and decoding methods cannot meet the high requirements of power control systems for real-time and floating-point data compression, and existing technologies cannot effectively improve the data transmission efficiency and security of power systems.
The varfloat algorithm is used to encode and decode floating-point data in the power control system. Combined with variable-length compressed encoding of integer data, the encoding and decoding process is optimized and the index creation overhead is reduced by defining a dedicated message description language and a function overloading mechanism in the programming language.
It significantly optimizes the network overhead of the power control system, improves the overall system performance and security, and realizes efficient and secure data transmission in the power control system.
Smart Images

Figure CN121455488A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a data encoding and decoding method and apparatus for business information interaction in power dispatching applications, belonging to the field of power system dispatching technology. Background Technology
[0002] As the advantages of the initial construction achievements of the power system dispatching cloud platform in power grid dispatching and production management become increasingly apparent, various disciplines are actively participating in the construction of the dispatching cloud application ecosystem. To meet the needs of power system transformation and upgrading, adapt to the continuous emergence of new equipment, and support various application scenarios, higher requirements are being placed on functions such as real-time data display and services, model structure design and management, platform public service components, and unified and efficient data interaction.
[0003] Currently, some related technologies have been implemented in the field of power monitoring systems. For example, Chinese patent publication number CN119150578A discloses a multi-service scheduling simulation method based on training simulation data. This method encodes / decodes data according to the protobuf data structure standard, introducing variable description indexes and floating-point type encoding methods from the protobuf project. Chinese patent publication number CN202211432564 designs a data encoding method, introducing hash indexes for data organization and using the varint algorithm to compress integer data. However, none of these methods compress the large amount of floating-point type data present in power control systems, and each method organizes binary data streams by introducing different additional indexes. Therefore, existing data encoding and decoding methods cannot meet the high real-time requirements of new power systems and urgently need further improvement. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a data encoding and decoding method and device for business information interaction in power control applications. It proposes the varfloat algorithm to encode / decode common variables in power control systems, filling the gap that open source projects such as protobuf do not support data compression of floating-point numbers.
[0005] To achieve the above objectives, the present invention is implemented using the following technical solution: In a first aspect, the present invention provides a data encoding and decoding method for business information interaction in power dispatching applications, comprising: Structured data, including power system operating parameters, is obtained from the power control system through a client. By calling the encoding interface through the client, the structured data is encoded into a binary data stream according to the predefined message description language specification. Specifically, variable-length compression encoding is used for integer data in the power system operating parameters; and varfloat algorithm is used to encode floating-point data in the power system operating parameters. The binary data stream is transmitted from the client to the server via the power communication network. The server receives the binary data stream and calls the decoding interface to decode the integer and floating-point data in the power system operating parameters, respectively, and decodes the binary data stream into structured data. The decoded structured data is transmitted from the server to the power control application module.
[0006] Furthermore, the variable-length compression encoding of integer data in power system operating parameters includes: dividing the integer data value into groups of 7 bits, and using the highest bit of each byte as a flag bit to indicate whether there are subsequent data bytes; the flag bit being 1 indicates that the subsequent byte still belongs to the current data, and being 0 indicates that the current byte is the last byte of the data.
[0007] Furthermore, the decoding of integer data in the power system operating parameters includes: For variable-length compressed integer data, read each byte sequentially and check the flag bits of each byte: If the highest bit of the currently read byte is 1, it indicates that the subsequent bytes still belong to the current data, and the lower 7 bits of the currently read byte are appended to the result; If the highest bit of the currently read byte is 0, it indicates that the currently read byte is the last byte of data. The lower 7 bits of the currently read byte are then appended to the result to complete the decoding and reconstruction of the integer data.
[0008] Furthermore, the encoding of floating-point data in the power system operating parameters using the varfloat algorithm includes: Calculate the difference between the current value and the preset reference value based on the floating-point data; Determine whether the difference is within a preset common fluctuation range; If it is within the range, the difference is converted into an integer and the variable-length compression encoding is performed, and a compression mode flag is set at the beginning of the encoded data; If the value is outside the range, the standard floating-point format will be used for encoding, and the corresponding uncompressed mode flag will be set.
[0009] Furthermore, the decoding of floating-point data in the power system operating parameters includes: For floating-point data encoded using the varfloat algorithm, the determination is based on the flag bits of the floating-point data: If it is a compression mode flag, the decoded integer difference is added to the base value of the floating-point data to restore the original floating-point value; If it is the uncompressed mode flag, it will be directly parsed as a standard floating-point number.
[0010] Furthermore, the encoding and decoding interfaces utilize the function overloading mechanism of programming languages to generate corresponding encoding and decoding functions based on data types during compilation, so that the corresponding encoding and decoding logic can be directly called at runtime without type judgment.
[0011] Furthermore, the power system operating parameters include voltage type data and frequency type data; the voltage type data includes any one or more of the following voltage values: 10kV, 35kV, 220kV, and 500kV; the reference value of the frequency type data is 50Hz, and the fluctuation range is ±1Hz.
[0012] Furthermore, the predefined message description language specification is defined through files with the .msg extension, supporting nested combinations of basic data types, composite data types, and basic data types of the power system.
[0013] Furthermore, the method also includes: before encoding, parsing the message description language specification file with a compiler to generate encoding and decoding interfaces corresponding to the C++ or JAVA programming language.
[0014] Furthermore, when the structured data is encoded into a binary data stream, the order in which the data fields are arranged in the data stream is the same as the order in which the data fields are defined in the message description language specification, and no additional index fields are introduced.
[0015] In a second aspect, the present invention provides a data encoding and decoding device for power control application business information interaction, used to implement the data encoding and decoding method for power control application business information interaction as described in any of the preceding claims. The device includes: an acquisition module, an encoding module, and a first transmission module disposed on the client side, and a receiving module, a decoding module, and a second transmission module disposed on the server side. The acquisition module is used to acquire structured data from the power control system, the structured data including power system operating parameters; The encoding module is used to call the encoding interface to encode the structured data into a binary data stream according to a predefined message description language specification. Specifically, variable-length compression encoding is used for integer data in the power system operating parameters; and varfloat algorithm is used to encode floating-point data in the power system operating parameters. The first transmission module is used to transmit the binary data stream to the server via a power communication network; The receiving module is used to receive the binary data stream; The decoding module is used to call the decoding interface to decode the integer data and floating-point data in the power system operating parameters respectively, and decode the binary data stream into structured data; The second transmission module is used to transmit the decoded structured data to the power control application business module.
[0016] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: 1. This invention provides additional encoding for frequently used variables during the interaction between modules in a power control system. Based on the characteristics of data transmission in power control systems, it proposes a varfloat algorithm for encoding floating-point numbers. This allows for the compression of power dispatch system variables such as voltage and frequency. For double-precision floating-point type power control system variables, the minimum encoding length is significantly reduced compared to the open-source project protobuf. This greatly optimizes network overhead during the interaction process of the power control system, improving the overall system performance and security.
[0017] 2. This invention defines a dedicated message description language and encoding / decoding method. It defines a message description language for structured data and the organization of data serialization within a data stream. This reduces the space and time overhead of creating indexes for each variable. During encoding, data type determination is performed using function overloading in the programming language, incurring no overhead during program execution, further optimizing the encoding / decoding calculation speed. On a dedicated server for power control systems, in a program written in C++, the encoding time of this invention is significantly reduced compared to protobuf.
[0018] 3. This invention enables data transmission and interaction between application services and between systems in the power control system, unifies the data interaction format, improves data interaction efficiency, and provides cross-language (C++, Java) support, fundamentally improving system security. Attached Figure Description
[0019] Figure 1 This is a general framework diagram of the data encoding and decoding method for power dispatching application business information interaction provided in the embodiments of the present invention; Figure 2 This is a schematic diagram of an example of a msg file provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the compiler compilation process provided in an embodiment of the present invention; Figure 4 This is a flowchart illustrating the encoding of the composite structure provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of structured data definition provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the organization of a binary byte stream provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the organization of each node provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the data compression principle provided in an embodiment of the present invention; Figure 9 This is a schematic diagram illustrating the data decompression principle provided in an embodiment of the present invention; Figure 10 This is a flowchart of the integer type encoding process provided in an embodiment of the present invention; Figure 11 This is a flowchart of the integer type decoding process provided in an embodiment of the present invention; Figure 12 This is a schematic diagram of the encoding method for the freq type provided in an embodiment of the present invention; Figure 13 This is a schematic diagram of the decoding method for the freq type provided in an embodiment of the present invention. Detailed Implementation
[0020] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0021] Example 1: This example introduces a data encoding and decoding method for business information interaction in power dispatching applications, including: Structured data, including power system operating parameters, is obtained from the power control system through a client. By calling the encoding interface through the client, the structured data is encoded into a binary data stream according to the predefined message description language specification. Specifically, variable-length compression encoding is used for integer data in the power system operating parameters; and varfloat algorithm is used to encode floating-point data in the power system operating parameters. The binary data stream is transmitted from the client to the server via the power communication network. The server receives the binary data stream and calls the decoding interface to decode the integer and floating-point data in the power system operating parameters, respectively, and decodes the binary data stream into structured data. The decoded structured data is transmitted from the server to the power control application module.
[0022] The data encoding and decoding method for power dispatching application business information interaction provided in this embodiment involves the following steps in its application process: Step 1: Overall Architecture; like Figure 1 As shown, this embodiment consists of three parts: message description language, compiler, and encoding / decoding algorithm.
[0023] Message Description Language: The two parties involved in the communication need to agree on the relevant data types for the communication. An intermediate data format independent of computer languages and system platforms should be defined. This data format needs to be described using a language independent of the development language and system platform. Support should also be provided for common data types in power control systems, and unified definitions should be agreed upon for common power grid parameters such as frequency and voltage.
[0024] Compiler: In order to convert the data types defined in the message description language file into data types that can be recognized by the computer language, it is necessary to develop a message description language compiler to convert the message description language file into a specific C++ / Java language interface for use by the application.
[0025] Encoding / Decoding API: Provides encoding and decoding API interfaces, supporting C++ / JAVA languages. Clients call the encoding API to encode data structures into binary streams, while servers call the decoding API to decode the binary streams back into data structures. A varfloat algorithm is designed to optimize the encoding / decoding of data types specific to power control systems, further reducing transmission and encoding / decoding costs.
[0026] Step 2: Message Definition Language; 1. Supported encoding / decoding types; Based on the characteristics of data types and custom objects in different computer languages, and considering the specific needs of power system monitoring and dispatching operations, a suitable structured data description language is specified. The format of this information description language is similar to that of C++ and Java programming languages, and it supports various basic and composite data types.
[0027] Based on the characteristics of frequently occurring data in power control systems, specific encoding methods are proposed for common data types such as voltage and frequency in power control systems to achieve better compression ratios.
[0028] The supported basic data types are shown in Table 1: Table 1 Basic Data Types
[0029] Supported composite data types are shown in Table 2: Table 2 Composite Data Types
[0030] The supported basic data types for power systems are shown in Table 3: Table 3 Basic Data of Power System
[0031] 2. Data definition method; The structured data in the information description language adopts a description method similar to that of C++ and Java programming languages to facilitate quick learning and reduce additional learning costs. Defined messages are saved as files with the .msg extension. This allows the use of another already defined message within a message. An example of a .msg file is shown below. Figure 2 As shown.
[0032] 3. Data compiler; The data compiler compiles a general-purpose structured information description language into file types recognizable by C++ and Java (.h files for C++; .jar files for Java), defining encoding / decoding interfaces. Users perform encoding and decoding tasks by calling these interfaces. The specific compilation process is as follows: Figure 3 As shown; Figure 3 The compilation process is demonstrated. First, the msg file is read line by line, and key fields are stored in the Token variable. Second, the contents of the Token variable are read in a loop, and corresponding attribute information is set according to different attributes. For composite types such as custom types, nested type attribute settings are performed. Third, it is determined whether to generate C++ or Java package, and the corresponding GenCpp or Genjava class is constructed. Finally, the corresponding C++ interface or Java package is generated based on the stored attribute information.
[0033] 4. Data encoding / decoding; 1) How structured data is organized in a byte stream; When multiple structured data items are encoded, they are arranged sequentially in the byte stream, with their relative order determined by the order of the structure definitions in the information description language. No additional structural information, such as the index structure introduced in open-source projects like protobuf, is required. The serialization process is as follows: Figure 4 As shown; Various types of judgments and coding processes during the coding process, such as Figure 4 As shown. After the input variable is passed to the encoding interface, the interface will first parse the top-level type of the passed variable (usually a user-defined type, message). At this point, the encoding interface will utilize the function overloading feature provided by the programming language to call the corresponding interface in the generated header file, which is provided by the compiler, to decompose the user-defined type and recursively pass all member variables of the message type to this interface. The passed variable type can be divided into three cases: If the member's type is a basic data type, the encoding interface library will directly implement the encoding based on the specific type, encoding the data into binary data and writing it sequentially into the buffer.
[0034] If the member's type is a basic data type of the power system, the encapsulated custom encoding algorithm interface will be invoked to encode it into a binary data stream.
[0035] If the member variable is a composite type, the partial specialization template function in the encoding library needs to be used to decompose the composite type, and all node data of the composite type should be recursively passed into this interface. If the composite type contains multiple nested types, multiple recursive calls are required. Finally, all types will be decomposed into basic data types for encoding / decoding, supporting type judgment of multiple nested structures. Theoretically, the nesting depth supported by the encoding is only limited by the stack space size in the runtime environment. The order of different data is determined by their definition in the message description language.
[0036] According to the encoding process, if defined as follows Figure 5 The structured data shown here, at this point, the binary byte stream organization of the structured variable HelloWorld after encoding is as follows: Figure 6 As shown; where node1, node2, node3...nodeN are the data for each node in the nodes variable. The internal organization of each node is as follows: Figure 7 As shown; This embodiment determines the position of variables in the binary data stream by using the relative order of variables in the information description language within the structured data, rather than recording the order by creating an index for each variable. This reduces the indexing overhead by one byte per variable compared to protobuf. The overall data volume decreases by 50% (for int8 type) to 11% (for int64 type) after encoding. It also reduces the time overhead of index creation and recognition during encoding / decoding, resulting in a decrease in encoding / decoding time.
[0037] 2) Integer data compression / decompression algorithm; This embodiment compresses integer data, improving its data compression capabilities for integers. The `int` type, common in programming languages, occupies 4 bytes in memory. The storage format of the number "1" in memory is as follows: 0000 0000|0000 0000| 0000 0000|0000 0001 ; In this case, the number "1" is represented using only one byte, while the other three bytes are not utilized. Transmitting an int type directly over the network would incur additional network bandwidth. The basic idea of data compression is to use less memory to represent small data values.
[0038] In this embodiment, the encoding algorithm uses the first 7 bits of each byte to represent the data portion, and the highest bit to indicate whether the data is complete. The specific principle is as follows: Figure 8 As shown; As can be seen, the data compression algorithm converts the integer 1 from 4 bytes to 1 byte and the integer 257 from 4 bytes to 2 bytes. This shows that the algorithm compresses data to different sizes depending on the original data value. Since smaller data constitutes the majority in actual encoding, this algorithm effectively compresses the total amount of encoded binary data. Furthermore, data compression does not lose the precision of the original data, making it a lossless compression algorithm. This compression method can compress data of unlimited length, providing a foundation for the transmission and storage of ultra-large-scale data.
[0039] The decoding algorithm is the inverse operation of the encoding algorithm: Each time, one byte of data is read from the binary data stream, the lower seven bits of this byte are appended to the data being decoded, and the highest bit is checked. If the highest bit is 1, it means the following byte is still the content of the data being decoded; if the highest bit is 0, it means the decoding of this data has been completed. For example... Figure 9 The diagram illustrates the data decoding process for int type data with values of 1 and 257. When the value is 1, the high-order bit of the first byte read is 0, indicating that the int type data is represented by only one byte. The lower 7 bits of the uncompressed data are directly copied into the decoded data, completing this decoding step. When the value is 257, the high-order bit of the first byte read is 1. After copying the lower 7 bits of this byte, the next data byte needs to be read. After reading the second binary data byte, the highest bit is found to be 0, indicating that the data consists of two bytes. After copying the second data, the data decoding ends.
[0040] The data compression implementation flowchart is as follows: Figure 10 As shown; Figure 10 The basic process of a data compression algorithm is introduced. For each compression step, it is necessary to determine whether the input value is greater than 0x80 (corresponding to binary code 1000,0000, indicating whether there is data above the seventh bit) and set a flag accordingly. Then, the 7 bits of data and the flag are written into the data stream. The data is then shifted right by seven bits each time.
[0041] The process of data decompression is the reverse process of data compression algorithms, and its flow is as follows: Figure 11As shown, since the decoding algorithm needs to read content from the memory provided by the user, adding an access bounds check is necessary. After reading each byte, the lower seven bits of the read data are shifted into the generated data. The highest bit flag is checked; if it is 1, data reading continues. The previous data is then shifted left by 7 bits, ultimately restoring the original data format.
[0042] 3) This embodiment proposes the varfloat algorithm, which is an optimization of the varint algorithm. Since many common data in power control systems are floating-point types (such as voltage and frequency), and in most cases, the data fluctuates around a reference value, we designed an encoding algorithm for frequency and voltage data. In most cases, this data is encoded to 1 to 2 bytes, significantly reducing the amount of data transmitted over the network. The encoding method is illustrated below using frequency as an example: Because frequency data in power control systems fluctuates within 50±1Hz in most cases, only the fractional part is encoded and transmitted during the encoding process. However, the cases where frequency fluctuations exceed 1Hz cannot be ignored, so a 1-bit identifier is needed to indicate whether the fluctuation range exceeds 1Hz. Therefore, for floating-point data of "50.12Hz", only "12" needs to be encoded and transmitted during encoding. The data "12" can then be compressed using integer compression methods. Considering the 1-bit identifier, it can be represented as follows: Figure 12 The encoding methods shown are as follows; for example, Figure 12 illustrates the encoding method for the `freq` type, which is a variation of the integer type encoding method. It has the following characteristics: The first bit indicates whether data compression encoding is used. 1 indicates compression, and 0 indicates the original encoding is used. The second bit of the first byte (the first bit is used when compressing integer types) is a flag bit indicating whether the next byte is the current data; subsequent bytes continue to use the first byte.
[0043] Similarly, when encoding a freq type of 50.1234 Hz, the encoding method is as follows: Figure 13 As shown, this algorithm can compress four bytes of float data to a minimum of one byte while meeting precision requirements, significantly reducing the transmission pressure on the network. For higher precision requirements, this method can achieve a similar precision level to a four-byte float type with only three bytes. Furthermore, since this encoding method can theoretically increase storage space to improve precision, it provides an encoding foundation for the transmission and storage of ultra-high precision floating-point numbers.
[0044] For data with fluctuations greater than 1Hz (which is very rare in power control systems), the original standard floating-point encoding is used by setting the sign bit to 1. In most cases, dedicated data in power control systems can be compressed to 1 to 2 bytes (depending on the specific numerical value).
[0045] This embodiment implements the encoding / decoding function for structured data, and performs data compression / decompression on integer types. This significantly reduces the network overhead of transferring structured data between modules within the control system. It supports encoding / decoding calculations for composite types such as sequential types and key-value pairs, as well as their nested structures with simple data types.
[0046] This embodiment provides a proprietary encoding / decoding method for data types specific to power control systems. Encoding / decoding common data types in power control systems significantly reduces the amount of data transmitted over the network. It supports the transmission and storage of ultra-high precision power control system data types, thereby improving the overall performance of the power control system.
[0047] This embodiment realizes data transmission and interaction between application services and between systems in the power control system, unifies the data interaction format, improves data interaction efficiency, and provides cross-language (C++, Java) support, fundamentally improving system security.
[0048] This embodiment defines a dedicated message description language and encoding / decoding method. It defines a message description language for structured data and the organization of data serialization within the data stream. This reduces the space and time overhead of creating indexes for each variable. During encoding, data type determination is performed using function overloading in the programming language, incurring no runtime overhead and further optimizing the encoding / decoding computation speed. On a dedicated server for power control systems, in a program written in C++, the encoding time of this embodiment is approximately 80% of that of protobuf.
[0049] This paper proposes an additional encoding method for frequently used variables in the interaction process between modules in a power dispatching system. Based on the characteristics of data transmission in power dispatching systems, a varfloat algorithm for encoding floating-point numbers is developed. This can compress power dispatching system variables such as voltage and frequency to 25% to 75% of their original length. For double-precision floating-point type power dispatching system variables, the minimum encoding length is only 11.1% of that of the open-source project protobuf. This significantly optimizes the network overhead during the interaction process of the power dispatching system, improving the overall system performance and security.
[0050] This embodiment designs an encoding / decoding method for a power control system. A unified structured data description language is defined, and based on the load characteristics of data transmission between modules in the power control system, dedicated data types are designed for key power grid variable types. Encoding methods for multi-level nested composite data structures and custom data structures are proposed, enabling multi-level nesting of composite and custom data types and supporting the combination of composite data types and power grid-specific data types. An encoding method for integer data types is defined, and additional encoding is applied to power control system-specific variables that were originally floating-point types, resulting in a significantly larger size compared to standard floating-point types.
[0051] This embodiment proposes a varfloat algorithm for encoding / decoding common variables in power control systems, filling the gap in open-source projects like protobuf that do not support floating-point data compression. While protobuf determines the type of each variable by creating an index, this embodiment achieves this through function overloading. This eliminates the overhead of type checking and index creation during encoding / decoding, increasing the speed. Furthermore, this embodiment reduces the space occupied by one index compared to protobuf when encoding each variable.
[0052] Example 2: This example provides a data encoding and decoding device for power dispatching application business information interaction, used to implement the data encoding and decoding method for power dispatching application business information interaction as described in Example 1. The device includes: an acquisition module, an encoding module, and a first transmission module disposed on the client side, and a receiving module, a decoding module, and a second transmission module disposed on the server side. The acquisition module is used to acquire structured data from the power control system, the structured data including power system operating parameters; The encoding module is used to call the encoding interface to encode the structured data into a binary data stream according to a predefined message description language specification. Specifically, variable-length compression encoding is used for integer data in the power system operating parameters; and varfloat algorithm is used to encode floating-point data in the power system operating parameters. The first transmission module is used to transmit the binary data stream to the server via a power communication network; The receiving module is used to receive the binary data stream; The decoding module is used to call the decoding interface to decode the integer data and floating-point data in the power system operating parameters respectively, and decode the binary data stream into structured data; The second transmission module is used to transmit the decoded structured data to the power control application business module.
[0053] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
[0054] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0055] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0056] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0057] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0058] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure and not to limit its protection scope. Although this disclosure has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading this disclosure, they can still make various changes, modifications or equivalent substitutions to the specific implementation of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the pending claims.
Claims
1. A data encoding and decoding method for business information interaction in power dispatching applications, characterized in that, include: Structured data, including power system operating parameters, is obtained from the power control system through a client. By calling the encoding interface through the client, the structured data is encoded into a binary data stream according to the predefined message description language specification. Specifically, variable-length compression encoding is used for integer data in the power system operating parameters; and varfloat algorithm is used to encode floating-point data in the power system operating parameters. The binary data stream is transmitted from the client to the server via the power communication network. The server receives the binary data stream and calls the decoding interface to decode the integer and floating-point data in the power system operating parameters, respectively, and decodes the binary data stream into structured data. The decoded structured data is transmitted from the server to the power control application module.
2. The data encoding and decoding method for power dispatching application business information interaction according to claim 1, characterized in that, The variable-length compression encoding of integer data in power system operating parameters includes: dividing the integer data value into groups of 7 bits, and using the highest bit of each byte as a flag bit to indicate whether there are subsequent data bytes; the flag bit being 1 indicates that the subsequent byte still belongs to the current data, and being 0 indicates that the current byte is the last byte of the data.
3. The data encoding and decoding method for power dispatching application business information interaction according to claim 2, characterized in that, Decoding the integer data in the power system operating parameters includes: For variable-length compressed integer data, read each byte sequentially and check the flag bits of each byte: If the highest bit of the currently read byte is 1, it indicates that the subsequent bytes still belong to the current data, and the lower 7 bits of the currently read byte are appended to the result; If the highest bit of the currently read byte is 0, it indicates that the currently read byte is the last byte of data. The lower 7 bits of the currently read byte are then appended to the result to complete the decoding and reconstruction of the integer data.
4. The data encoding and decoding method for power dispatching application business information interaction according to claim 1, characterized in that, The encoding of floating-point data in power system operating parameters using the varfloat algorithm includes: Calculate the difference between the current value and the preset reference value based on the floating-point data; Determine whether the difference is within a preset common fluctuation range; If it is within the range, the difference is converted into an integer and the variable-length compression encoding is performed, and a compression mode flag is set at the beginning of the encoded data; If the value is outside the range, the standard floating-point format will be used for encoding, and the corresponding uncompressed mode flag will be set.
5. The data encoding and decoding method for power dispatching application business information interaction according to claim 4, characterized in that, Decoding the floating-point data in the power system operating parameters includes: For floating-point data encoded using the varfloat algorithm, the determination is based on the flag bits of the floating-point data: If it is a compression mode flag, the decoded integer difference is added to the base value of the floating-point data to restore the original floating-point value; If it is the uncompressed mode flag, it will be directly parsed as a standard floating-point number.
6. The data encoding and decoding method for power dispatching application business information interaction according to claim 5, characterized in that, The encoding and decoding interfaces utilize the function overloading mechanism of programming languages to generate corresponding encoding and decoding functions based on data types at compile time, so that the corresponding encoding and decoding logic can be directly called at runtime without type judgment.
7. The data encoding and decoding method for power dispatching application business information interaction according to claim 5, characterized in that, The power system operating parameters include voltage type data and frequency type data; the voltage type data includes any one or more of the following voltage values: 10kV, 35kV, 220kV, and 500kV; the reference value of the frequency type data is 50Hz, and the fluctuation range is ±1Hz.
8. The data encoding and decoding method for power dispatching application business information interaction according to claim 1, characterized in that, The predefined message description language specification is defined through files with the .msg extension, and supports nested combinations of basic data types, composite data types, and basic data types of the power system.
9. The data encoding and decoding method for power dispatching application business information interaction according to claim 1, characterized in that, The method further includes: before encoding, using a compiler to parse the message description language specification file to generate encoding and decoding interfaces corresponding to the C++ or JAVA programming languages.
10. The data encoding and decoding method for power dispatching application business information interaction according to claim 1, characterized in that, When the structured data is encoded into a binary data stream, the order in which the data fields are arranged in the data stream is the same as the order in which the data fields are defined in the message description language specification, and no additional index fields are introduced.
11. A data encoding and decoding device for business information interaction in power dispatching applications, characterized in that, The device for implementing the data encoding and decoding method for power control application business information interaction as described in any one of claims 1-10 includes: an acquisition module, an encoding module, and a first transmission module disposed on the client side, and a receiving module, a decoding module, and a second transmission module disposed on the server side. The acquisition module is used to acquire structured data from the power control system, the structured data including power system operating parameters; The encoding module is used to call the encoding interface to encode the structured data into a binary data stream according to a predefined message description language specification. Specifically, variable-length compression encoding is used for integer data in the power system operating parameters; and varfloat algorithm is used to encode floating-point data in the power system operating parameters. The first transmission module is used to transmit the binary data stream to the server through the power communication network; The receiving module is used to receive the binary data stream; The decoding module is used to call the decoding interface to decode the integer data and floating-point data in the power system operating parameters respectively, and decode the binary data stream into structured data; The second transmission module is used to transmit the decoded structured data to the power control application business module.
Citation Information
Patent Citations
Power data exchange method
CN116248703A
Scheduling multi-service simulation method and device based on training simulation data
CN119150578A