Electric energy meter data conversion method, device, computer equipment and storage medium
By introducing a protocol conversion layer into the electric energy meter and converting data identification and encoding information, it solves the difficulty of modifying functional modules and data storage when the protocol changes in the electric energy meter, and achieves compatibility with multiple protocols and data transmission efficiency.
Patent Information
- Application Number
- CN202410832877.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-06-26
AI Technical Summary
When adding a communication protocol or modifying an existing protocol in an electric energy meter, each functional module and data storage need to be modified, making the process complex and difficult.
By introducing a protocol conversion layer into the electric energy meter, it receives the data frame of the superior communication protocol, obtains and converts the data identification and encoding information, and makes it consistent with the internal data identification and encoding information of the electric energy meter, thereby being compatible with multiple communication protocols and avoiding Affects other functional modules and data storage.
It is realized that when the communication protocol is added or modified in the electric energy meter, other functional modules and data storage are not affected, the protocol change process is simplified, and the compatibility and efficiency of data transmission are improved.
Smart Images

Figure CN118400443B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric energy meters, and in particular to an electric energy meter data conversion method, device, computer equipment and storage medium. Background Art
[0002] In order to adapt to the needs of power grid reform and development, the energy meter implements the DL / T698 protocol (a communication protocol designed for smart energy meters, mainly used for remote monitoring, data collection and operation control of energy meters). However, since it is impossible to update all the energy meter field installation and collection systems to the new protocol equipment at the same time, compatibility with the original energy meter DL / T645 protocol (a protocol for communication between smart energy meters and data collection equipment) is essential. In addition, with the continuous development of smart meter business, there is an increasing demand to support a variety of other energy meter communication protocols.
[0003] Different protocols use different data identifiers in the application process of each functional module in the electric energy meter, and the data format for data storage is also different. On this basis, the change of the protocol requires the modification of each functional module and data storage in the electric energy meter, making it particularly difficult to modify or change the protocol. Therefore, there is an urgent need for an electric energy meter data conversion method that is compatible with multiple protocols. Summary of the invention
[0004] In view of this, the present invention provides an electric energy meter data conversion method, device, computer equipment and storage medium to solve the problem that when a communication protocol is added to the electric energy meter or the protocol is modified, the functional modules and data storage in the electric energy meter must be modified.
[0005] In a first aspect, the present invention provides a method for converting data of an electric energy meter, wherein the electric energy meter includes a protocol conversion layer, and the method includes:
[0006] Receive data frames sent by the superior communication protocol;
[0007] Acquire a first data identifier and first coding information of a communication protocol in a data frame;
[0008] The protocol conversion layer is used to convert the first data identifier into the second data identifier of the electric energy meter, and the first coded information is converted into the second coded information of the electric energy meter.
[0009] The electric energy meter data conversion method provided by the present invention converts the first data identifier (protocol data identifier) and the first coding information (protocol coding information) in the upper-level communication protocol into the second data identifier and the second coding information of the electric energy meter through the protocol conversion layer, so that the protocol data identifier and the protocol coding information of the external communication protocol are kept consistent with the internal data identifier and the internal coding information of the electric energy meter, and is compatible with the data transmission of multiple communication protocols. It achieves the purpose of not affecting other functional modules and data storage when adding a communication protocol to the electric energy meter or modifying the communication protocol, and solves the problem that when adding a communication protocol to the electric energy meter or modifying the protocol, the functional modules and data storage in the electric energy meter must be modified.
[0010] In an optional implementation, the first data identifier is represented by an object data descriptor of preset bytes, the object data descriptor includes an object identifier, an attribute identifier and its characteristics and an index of an element within the attribute, and the object identifier includes a high byte and a low byte. In the electric energy meter data conversion method provided by the present invention, the first data identifier is represented by an object data descriptor of preset bytes, the object data descriptor includes an object identifier, an attribute identifier and its characteristics and an index of an element within the attribute, and the object identifier includes a high byte and a low byte, and the data format of the first data identifier provides a data format basis for the conversion of the subsequent protocol conversion layer.
[0011] In an optional implementation, before using the protocol conversion layer to convert the first data identifier into the second data identifier of the electric energy meter, the electric energy meter data conversion method further includes:
[0012] Set the second data identification byte and the first rule table corresponding to each byte;
[0013] Setting the second encoding information byte and the second rule table corresponding to each byte;
[0014] A conversion table is generated based on the second data identification byte, the first rule table, the second encoding information byte, and the second rule table.
[0015] The electric energy meter data conversion method provided by the present invention sets a second data identification byte and a first rule table corresponding to each byte; sets a second coding information byte and a second rule table corresponding to each byte; and generates a conversion table based on the second data identification byte, the first rule table, the second coding information byte and the second rule table, providing a table basis for the conversion operation of the subsequent protocol conversion layer, facilitating the conversion operation.
[0016] In an optional implementation, the second data identification byte includes a belonging module byte, an internal offset number byte, and a row number byte, and the first rule table corresponding to each byte includes: a belonging module number table, an internal offset number table, and a row number table;
[0017] The second coding information byte includes a judgment coding type byte, a complex type byte or a basic type byte, and the second rule table corresponding to each byte includes: a judgment coding type table, a complex type coding table and a basic type coding table;
[0018] Generating a conversion table based on the second data identification byte, the first rule table, the second encoding information byte, and the second rule table includes:
[0019] Generate a three-level table based on the judgment coding type table, the complex type coding table and the basic type coding table;
[0020] Generate a secondary table based on the internal offset number table, the row number table and the third-level table address, the secondary table including the third-level table addresses corresponding to the low bytes of different object identifiers;
[0021] Generate a primary table based on the secondary table address and the belonging module number table; the primary table includes secondary table addresses corresponding to high bytes of different object identifiers;
[0022] Generate a conversion table based on the primary table, the secondary table, and the tertiary table.
[0023] The electric energy meter data conversion method provided by the present invention provides a data format basis for the first coding information of the external communication protocol and the second coding information of the electric energy meter based on a three-level table generated by judging a coding type table, a complex type coding table and a basic type coding table, generates a second-level table based on an internal offset number table, a row number table and a third-level table address, the second-level table includes the third-level table addresses corresponding to the low bytes of different object identifiers, and provides a table basis for subsequently searching for the third-level table addresses in the second-level table, generates a first-level table based on the second-level table address and an attribution module number table; the first-level table includes the second-level table addresses corresponding to the high bytes of different object identifiers, and provides a table basis for subsequently searching for the second-level table addresses in the first-level table, and generates a conversion table based on the first-level table, the second-level table and the third-level table, which provides a table basis for the conversion of the subsequent protocol conversion layer, is convenient for users to search, and paves the way for improving the search and conversion efficiency.
[0024] In an optional implementation, using a protocol conversion layer to convert the first data identifier into a second data identifier of the electric energy meter, and converting the first coded information into the second coded information of the electric energy meter includes:
[0025] Determine the type of upper-level communication protocol;
[0026] Based on the upper communication protocol type, the protocol conversion layer is used to search the conversion table for the object data descriptor corresponding to the first data identifier and the table address corresponding to the first coding information, and the second data identifier and the second coding information of the electric energy meter are correspondingly generated based on the corresponding table address.
[0027] In an optional implementation, based on the upper communication protocol type, using the protocol conversion layer to search the conversion table for the object data descriptor corresponding to the first data identifier and the first coding information, and generating the second data identifier and the second coding information of the electric energy meter based on the corresponding table address includes:
[0028] Search the primary table based on the high byte of the object identifier to obtain the secondary table address and the module byte corresponding to the high byte of the object identifier;
[0029] Search the secondary table based on the secondary table address and the low byte of the object identifier to obtain the third-level table address, internal offset number byte and row number byte corresponding to the low byte of the object identifier;
[0030] Search the third-level table based on the third-level table address and attribute identifier and its characteristics to obtain the corresponding attribute and corresponding coding information;
[0031] The second data identifier and the second coding information of the electric energy meter are generated based on the belonging module byte, the internal offset number byte, the row number byte, the corresponding attribute, the element index within the attribute and the coding information.
[0032] The electric energy meter data conversion method provided by the present invention finally obtains the belonging module byte, internal offset number byte, row number byte, corresponding attribute, element index within the attribute and coding information by searching the table address of the corresponding table, and generates the second data identifier and second coding information of the electric energy meter based on the belonging module byte, internal offset number byte, row number byte, corresponding attribute, element index within the attribute and coding information, so that the protocol data identifier and protocol coding information of the external communication protocol are kept consistent with the internal data identifier and internal coding information of the electric energy meter. When a communication protocol is added to the electric energy meter or the communication protocol is modified, the electric energy meter can also smoothly transmit data without affecting other functional modules and data storage.
[0033] In an optional implementation, the electric energy meter further includes a plurality of functional modules, and the electric energy meter data conversion method further includes:
[0034] The second data identifier and the second coding information are forwarded to the corresponding functional module for data application.
[0035] The electric energy meter data conversion method provided by the present invention forwards the second data identifier and the second coding information to the corresponding functional module for data application. The converted second data identifier and the second coding information facilitate the corresponding functional module in the electric energy meter to apply and process the data, thereby achieving the purpose of not affecting other functional modules and data storage when adding a communication protocol or modifying the communication protocol in the electric energy meter.
[0036] In a second aspect, the present invention provides an electric energy meter data conversion device, the electric energy meter includes a protocol conversion layer, and the device includes:
[0037] A receiving module, used for receiving data frames sent by the communication protocol;
[0038] An acquisition module, used to acquire a first data identifier and first coding information of a communication protocol in a data frame;
[0039] The conversion module is used to convert the first data identifier into the second data identifier of the electric energy meter by using the protocol conversion layer, and convert the first coded information into the second coded information of the electric energy meter.
[0040] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the electric energy meter data conversion method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the electric energy meter data conversion method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 is a flow chart of a method for converting electric energy meter data according to an embodiment of the present invention;
[0044] Figure 2 is a flow chart of another method for converting electric energy meter data according to an embodiment of the present invention;
[0045] Figure 3 is a flow chart of another method for converting electric energy meter data according to an embodiment of the present invention;
[0046] Figure 4 is a schematic diagram of an application structure of an electric energy meter protocol conversion according to an embodiment of the present invention;
[0047] Figure 5It is a flow chart of converting the object data descriptor (Over Air Download, referred to as OAD) of the DL / T698 communication protocol to the internal data identifier (Device Identifier, referred to as DI) of the electric energy meter according to an embodiment of the present invention;
[0048] Figure 6 It is a flow chart of converting a DL / T645 protocol data identifier (Device Identifier, DI for short) to an electric energy meter internal data identifier (Device Identifier, DI for short) according to an embodiment of the present invention;
[0049] Figure 7 is a structural block diagram of an electric energy meter data conversion device according to an embodiment of the present invention;
[0050] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 scope of protection of the present invention.
[0052] According to an embodiment of the present invention, an embodiment of an electric energy meter data conversion method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0053] In this embodiment, a method for converting electric energy meter data is provided, which can be used for electric energy meters. The electric energy meters include smart Internet of Things electric energy meters, smart electric energy meters, Inner Mongolia's new generation of smart electric energy meters, etc. The electric energy meters include a protocol conversion layer. Figure 1 is a flow chart of a method for converting electric energy meter data according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0054] Step S101, receiving a data frame sent by an upper-level communication protocol.
[0055] Specifically, the upper communication protocol includes the communication protocol of the upper network layer, such as the DL / T698 communication protocol (a communication protocol designed for smart electric energy meters, mainly used for remote monitoring, data collection and operation control of electric energy meters) and the DL / T645 communication protocol (a protocol for communication between smart electric energy meters and data collection devices). The DLMS protocol (Distribution Line Message Specification, referred to as DLMS) has been further developed into a device language message specification, which aims to provide an interoperable environment for data exchange between meters (such as electric energy meters), support the measurement of any energy type such as electricity, water, gas or heat, and is applied to remote meter reading, remote control and value-added services.
[0056] When the upper network layer transmits data with the electric energy meter, the data is transmitted in the form of data frames. Data frames are protocol data units for transmitting communication protocol data and are used for data transmission in the network.
[0057] Exemplarily, a DL / T698 communication protocol data frame includes a data identifier and coding information corresponding to the data identifier one by one, and the coding information refers to the data format of each data identifier.
[0058] When the superior control system transmits data with the electric energy meter, the data is sent down according to a certain communication protocol, and the electric energy meter receives the data frame sent down by the superior communication protocol.
[0059] Step S102, obtaining a first data identifier and first coding information of a communication protocol in a data frame.
[0060] Specifically, when the electric energy meter receives a data frame sent under the DL / T698 communication protocol, the first data identifier and the first coding information of the DL / T698 communication protocol are obtained.
[0061] Step S103: using a protocol conversion layer to convert the first data identifier into a second data identifier of the electric energy meter, and converting the first coded information into second coded information of the electric energy meter.
[0062] Specifically, Figure 4 As shown, the protocol conversion layer of the electric energy meter is used to convert the first data identifier into the second data identifier of the electric energy meter, and convert the first coded information into the second coded information of the electric energy meter. The second data identifier of the electric energy meter is also called the internal data identifier of the electric energy meter, which can be represented as the actual data content of the electric energy meter, for example, the internal electric energy data identifier and instantaneous quantity data identifier of the electric energy meter.
[0063] When the first data identifier and the first coding information in the upper communication protocol are obtained, the first data identifier and the first coding information of the corresponding communication protocol are converted into the second data identifier and the second coding information of the electric energy meter respectively through the protocol conversion layer.
[0064] The electric energy meter data conversion method provided in this embodiment converts the first data identifier (protocol data identifier) and the first coding information (protocol coding information) in the upper-level communication protocol into the second data identifier and the second coding information of the electric energy meter through the protocol conversion layer, so that the protocol data identifier and the protocol coding information of the external communication protocol are kept consistent with the internal data identifier and the internal coding information of the electric energy meter, and is compatible with the data transmission of multiple communication protocols. It achieves the purpose of not affecting other functional modules and data storage when adding a communication protocol to the electric energy meter or modifying the communication protocol, and solves the problem that when adding a communication protocol to the electric energy meter or modifying the protocol, the functional modules and data storage in the electric energy meter must be modified.
[0065] In this embodiment, a method for converting electric energy meter data is provided, which can be used for electric energy meters. The electric energy meters include smart Internet of Things electric energy meters, smart electric energy meters, Inner Mongolia's new generation of smart electric energy meters, etc. The electric energy meters include a protocol conversion layer. Figure 2 is a flow chart of a method for converting electric energy meter data according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0066] Step S201, receiving the data frame sent by the upper communication protocol. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0067] Step S202: Acquire a first data identifier and first coding information of a communication protocol in a data frame.
[0068] Specifically, the first data identifier is represented by an object data descriptor of preset bytes, the object data descriptor includes an object identifier, an attribute identifier and its characteristics and an element index within the attribute, and the object identifier includes a high byte and a low byte. The preset bytes are set according to actual needs and are not specifically limited here.
[0069] Exemplarily, taking the first data identifier as a DL / T698698 communication protocol data identifier as an example, the DL / T698698 communication protocol data identifier is an object data descriptor (Object Attribute Descriptor, referred to as OAD).
[0070] The object data descriptor OAD consists of 4 bytes: 2 bytes of object identifier OI (Object Identifier, referred to as OI), 1 byte of attribute identifier and characteristics (unsigned), and 1 byte of element index within the attribute (unsigned (1...255)).
[0071] The object data descriptor OAD code is represented as follows:
[0072] OAD:=SEQUENCE
[0073] {
[0074] Object Identifier
[0075] Attribute identifier and its characteristics unsigned
[0076] Index of the element in the attribute unsigned (1...255)
[0077] }
[0078] The object identifier (OI) consists of two bytes, OIA and OIB. The high byte is defined as OIA and the low byte is defined as OIB.
[0079] Step S203, setting the second data identification byte and the first rule table corresponding to each byte.
[0080] Specifically, the second data identification byte includes a belonging module byte, an internal offset number byte and a row number byte, and the first rule table corresponding to each byte includes: a belonging module number table, an internal offset number table and a row number table.
[0081] The second data identification byte is 4 bytes. The second data identification is also called the internal data identification (internal DI in ) bytes are represented by the following Table 1:
[0082] Table 1
[0083]
[0084] In Table 1, Bit indicates the number of bits, 8Bit = 1 byte, Bit24-Bit31 indicates that bits 24 to 31 belong to a module of 1 byte, Bit16-Bit23 indicates that bits 16 to 23 are internal offset numbers of 1 byte, Bit0-Bit14 indicates that bits 0 to 14 are row numbers of 2 bytes. In order to facilitate data extension of the second data identifier, reserved bits are also defined, that is, Bit15 indicates that bit 15 is a reserved bit.
[0085] The table of module numbers corresponding to module bytes is shown in Table 2 below:
[0086] Table 2
[0087]
[0088] In the above table, for example, when you want to find the electric energy number of the belonging module, you must first look for Bit24-Bit31 of the second data identifier. When you find Bit24-Bit31, then check the number of Bit24-Bit31. When the number is 00, the corresponding belonging module name is electric energy. The internal offset number table and the row number table may include subordinate attributes under the belonging module name in the belonging module table. For example, when the belonging module name is electric energy, the corresponding row number table may include multiple forward electric energies and multiple reverse electric energies arranged in sequence, and the corresponding internal offset number table may include multiple rates corresponding to the forward electric energy and reverse electric energy arranged in sequence, etc. The contents of the internal offset number table and the row number table are no longer listed.
[0089] Step S204, setting the second encoding information bytes and the second rule table corresponding to each byte.
[0090] Specifically, the second coding information byte includes a coding type determination byte, a complex type byte or a basic type byte, and the second rule table corresponding to each byte includes: a coding type determination table, a complex type coding table and a basic type coding table.
[0091] The second coding information is also called the internal coding of the electric energy meter. According to the coding rules in the existing protocol, the second coding information is defined as 2 bytes. The second coding information is shown in Table 3 below:
[0092] Table 3
[0093]
[0094] In the above table, Bit15 indicates that bit 15 is used to determine whether it is a complex type coding bit, Bit8-Bit14 indicates that bits 8 to 14 are complex type coding values, and Bit0-Bit7 indicates that bits 0 to 7 are basic type coding values.
[0095] The complex type encoding table is shown in Table 4 below:
[0096] Table 4
[0097]
[0098] The basic type encoding values are shown in Table 5 below:
[0099] Table 5
[0100]
[0101] Step S205: Generate a conversion table based on the second data identification byte, the first rule table, the second encoding information byte and the second rule table.
[0102] Specifically, the above step S205 includes:
[0103] Step S2051, generating a three-level table based on the judgment coding type table, the complex type coding table and the basic type coding table.
[0104] Specifically, the three-level table is defined as follows:
[0105] typedef struct
[0106] {
[0107] ushort16 V_usInCodeID; / Internal code / fixed value /
[0108] ushort16 V_usFixedData ; / Fixed value /
[0109] }Str_OADtoDI_TableL3_T; / OAD conversion three-level table /
[0110] in, / Internal code / fixed value / Includes the code values found in the judgment code type table, complex type code table and basic type code table. Fixed value means that the values of certain data items are fixed in the electric energy meter, such as the decimal places and units of electricity. The values of these data items are directly listed in the conversion table for direct response during communication reading.
[0111] Step S2052 , generating a secondary table based on the internal offset number table, the row number table and the third-level table address, the secondary table including the third-level table addresses corresponding to the low bytes of different object identifiers.
[0112] Specifically, the secondary table is defined as follows:
[0113] typedef struct
[0114] {
[0115] ulong32 V_ulTableL3Addr; / Third level table address /
[0116] uchar8V_ucOIB; / OIB or DI2 /
[0117] uchar8V_ucLineNum; / Number of rows in the third-level table /
[0118] }Str_OADtoDI_TableL2_T; / OAD conversion secondary table /
[0119] Above / Number of rows in the third-level table / indicates the row number of the third-level table address found in the second-level table.
[0120] Step S2053, generating a primary table based on the secondary table address and the belonging module number table; the primary table includes secondary table addresses corresponding to high bytes of different object identifiers.
[0121] Specifically, the first-level table is defined as follows:
[0122] typedef struct
[0123] {
[0124] ulong32 V_ulTableL2Addr; / Secondary table address /
[0125] uchar8V_ucOIA; / OIA or DI3 /
[0126] uchar8V_ucLineNum; / Secondary table row number /
[0127] }Str_OADtoDI_TableL1_T; / OAD conversion primary table / .
[0128] Step S2054: Generate a conversion table based on the primary table, the secondary table, and the tertiary table.
[0129] Specifically, the primary table including the secondary table address, the secondary table including the tertiary table address, and the tertiary table together constitute a conversion table.
[0130] Step S206: Use the protocol conversion layer to convert the first data identifier into the second data identifier of the electric energy meter, and convert the first coded information into the second coded information of the electric energy meter. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0131] In the electric energy meter data conversion method provided in this embodiment, the first data identifier is represented by an object data descriptor of preset bytes, the object data descriptor includes an object identifier, an attribute identifier and its characteristics and an element index within the attribute, the object identifier includes a high byte and a low byte, and the data format of the first data identifier provides a data format basis for the subsequent conversion of the protocol conversion layer; the three-level table generated based on the judgment coding type table, the complex type coding table and the basic type coding table provides a data format basis for the first coding information of the external communication protocol and the second coding information of the electric energy meter, the second-level table is generated based on the internal offset number table, the row number table and the third-level table address, the second-level table includes the third-level table addresses corresponding to the low bytes of different object identifiers, and provides a table basis for the subsequent search of the third-level table address in the second-level table, and the first-level table is generated based on the second-level table address and the belonging module number table; the first-level table includes the second-level table addresses corresponding to the high bytes of different object identifiers, and provides a table basis for the subsequent search of the second-level table address in the first-level table, and the conversion table generated based on the first-level table, the second-level table and the third-level table provides a table basis for the subsequent conversion of the protocol conversion layer, which is convenient for users to search and paves the way for improving the search and conversion efficiency.
[0132] In this embodiment, a method for converting electric energy meter data is provided, which can be used for electric energy meters. The electric energy meters include smart Internet of Things electric energy meters, smart electric energy meters, Inner Mongolia's new generation of smart electric energy meters, etc. The electric energy meters include a protocol conversion layer. Figure 3 is a flow chart of a method for converting electric energy meter data according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0133] Step S301, receiving the data frame sent by the upper communication protocol. Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0134] Step S302, obtain the first data identifier and first coding information of the communication protocol in the data frame. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0135] Step S303: using a protocol conversion layer to convert the first data identifier into a second data identifier of the electric energy meter, and converting the first coded information into second coded information of the electric energy meter.
[0136] Specifically, the above step S303 includes:
[0137] Step S3031, determine the upper-level communication protocol type.
[0138] Specifically, when the protocol conversion layer performs conversion, the upper communication protocol type is first determined. For example, if the upper communication protocol is the DL / T698 communication protocol, if it is determined that it is not the DL / T698 communication protocol, the data transmission is considered incorrect, and the conversion process is exited until the determined communication protocol is the DL / T698 communication protocol. Determining the upper communication protocol type can ensure the correctness of data transmission.
[0139] Step S3032, based on the upper communication protocol type, use the protocol conversion layer to search the conversion table for the object data descriptor corresponding to the first data identifier and the table address corresponding to the first coding information, and generate the second data identifier and second coding information of the electric energy meter based on the corresponding table address.
[0140] In an optional implementation, the above step S3033 includes:
[0141] Step a1, searching the primary table based on the high byte of the object identifier, and obtaining the secondary table address and the module byte corresponding to the high byte of the object identifier.
[0142] Specifically, based on the object identification high byte OIA, the belonging module byte and the belonging module number table in the second data identification byte are searched to find the secondary table address and the belonging module byte corresponding to the belonging module number.
[0143] For example, the belonging module byte in the second data identification byte is searched based on the object identification high byte OIA. When the belonging module byte in the second data identification byte is 00, the secondary table address corresponding to the belonging module number is obtained as electric energy.
[0144] Step a2, searching the secondary table based on the secondary table address and the low byte of the object identifier, and obtaining the tertiary table address, internal offset number byte and row number byte corresponding to the low byte of the object identifier.
[0145] Exemplarily, based on the secondary table address of electric energy, the internal offset number byte and the row number byte in the second data identification byte are searched to obtain the third-level table address of the coding information corresponding to the internal offset table and the row number table corresponding to the electric energy, as well as the forward electric energy and reverse electric energy corresponding to the electric energy in the row number table, and multiple rates corresponding to the forward electric energy and the reverse electric energy in the internal offset table, and finally the internal offset number value and the row number value are obtained.
[0146] Step a3, searching the third-level table based on the third-level table address and attribute identifier and its characteristics, and obtaining corresponding attributes and corresponding coding information.
[0147] Exemplarily, based on the three-level table address and the electric energy attribute identification, a three-level table consisting of a search and judgment coding type table, a complex type coding table and a basic type coding table is obtained to obtain the electric energy attribute and the coding information corresponding to the electric energy attribute.
[0148] Step a4, generating a second data identifier and second coding information of the electric energy meter based on the belonging module byte, the internal offset number byte, the row number byte, the corresponding attribute, the element index within the attribute and the coding information.
[0149] Exemplarily, based on the obtained electric energy, forward electric energy and reverse electric energy, multiple rates corresponding to the forward electric energy and reverse electric energy respectively, electric energy attributes and coding information corresponding to the electric energy attributes, and element index within the attribute, data identification and coding information of the electric energy in the electric energy meter are generated.
[0150] Step S304: the electric energy meter further includes a plurality of functional modules, which forward the second data identifier and the second coding information to corresponding functional modules for data application.
[0151] Specifically, the electric energy meter also includes multiple functional modules, which forward the second data identifier and the second coding information to the corresponding functional modules for data application. The converted second data identifier and the second coding information facilitate the corresponding functional modules in the electric energy meter to apply and process the data.
[0152] It should be noted that: when a functional module of the electric energy meter reports communication data to the superior communication protocol, the second data identifier and the second coding information of the electric energy meter are converted into the first data identifier and the first coding information of the superior communication protocol through the protocol conversion layer of the electric energy meter, which is the opposite process of the process of the superior communication protocol sending data to the electric energy meter.
[0153] The electric energy meter data conversion method provided in this embodiment obtains the belonging module byte, internal offset number byte, row number byte, corresponding attribute, element index within the attribute and coding information by searching the table address of the corresponding table, and generates the second data identifier and second coding information of the electric energy meter based on the belonging module byte, internal offset number byte, row number byte, corresponding attribute, element index within the attribute and coding information, so that the protocol data identifier and protocol coding information of the external communication protocol are consistent with the internal data identifier and internal coding information of the electric energy meter. When a communication protocol is added to the electric energy meter or the communication protocol is modified, the electric energy meter can also smoothly transmit data without affecting other functional modules and data preservation.
[0154] As one or more specific application embodiments of the embodiments of the present invention, taking the conversion of the object data descriptor (Over Air Download, OAD) of the DL / T698 communication protocol to the internal data identifier (Device Identifier, DI) of the electric energy meter and the conversion of the data identifier (Device Identifier, DI) of the DL / T645 protocol to the internal data identifier (Device Identifier, DI) of the electric energy meter as an example, the process of the electric energy meter data conversion method provided in this embodiment is as follows:
[0155] like Figure 5 As shown in the figure, the conversion process of DL / T698 communication protocol object data descriptor (Over Air Download, referred to as OAD) to the internal data identifier (Device Identifier, referred to as DI) of the electric energy meter is as follows:
[0156] After receiving the data frame of DL / T698 communication protocol sent by the upper communication, the electric energy meter first determines the type of communication protocol, and exits if it is not DL / T698 communication protocol; after the protocol is correct for DL / T698 communication protocol, it is converted through the protocol conversion layer: the high byte of the object identifier OIA is used to search the first-level table, and after finding the corresponding row of the high byte of the object identifier OIA, the belonging module byte DIin3 and the address of the second-level table of the internal data identifier of the electric energy meter are obtained; the second-level table is searched according to the address of the second-level table and the low byte of the object identifier OIB, and after finding the corresponding row of the low byte of the object identifier OIB, the address of the third-level table, the internal offset number byte and the row number byte are obtained; the third-level table is searched according to the address of the third-level table and the object attributes in the object data descriptor OAD, and after finding the corresponding attributes and corresponding coding information, the internal data identifier DIin0 and DIin1 are obtained; the internal data identifier DIin2 is the internal index of the object carried by OAD itself, so as to obtain the complete internal data identifier and internal coding. Among them, DIin0 and Diin1 correspond to bit0-bit14, and DIin2 corresponds to bit16-bit23.
[0157] like Figure 6 As shown in the figure, the conversion process of DL / T645 protocol data identifier (Device Identifier, referred to as DI) to the internal data identifier (Device Identifier, referred to as DI) of the electric energy meter is as follows:
[0158] After the electric energy meter receives the data frame of DL / T645 communication protocol sent by the upper communication, it first determines the type of communication protocol, and exits if it is not DL / T645 communication protocol; after the protocol is DL / T645 communication protocol, it is converted through the protocol conversion layer: the protocol data identifier DI3 is used to search the first-level table, and after finding the corresponding row of protocol data identifier DI3, the internal data identifier DI is obtained. in DI3 and the secondary table address; search the secondary table according to the secondary table address and DI2 in the protocol data identifier, and after finding the corresponding row of DI2, get the third-level table address; search the primary table according to the third-level table address and DI1 in the protocol data identifier, and after finding DI1, get the internal data identifier DI in DI in 0; internal data identifier DI in DI in2 DI0, which is the protocol data identifier, is used to obtain the complete internal data identifier DIin and internal coding.
[0159] The electric energy meter data conversion method provided in this embodiment is compatible with multi-protocol electric energy meters. When a protocol is added to the electric energy meter or the protocol is modified, other functional modules and data preservation are not affected. The added communication protocol or the modified communication protocol can be converted into data identification and coding information inside the electric energy meter through the protocol conversion layer.
[0160] In this embodiment, an electric energy meter data conversion device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0161] This embodiment provides an electric energy meter data conversion device, such as Figure 7 As shown, including:
[0162] The receiving module 701 is used to receive data frames sent by the communication protocol.
[0163] The acquisition module 702 is used to acquire the first data identifier and first coding information of the communication protocol in the data frame.
[0164] The conversion module 703 is used to convert the first data identifier into the second data identifier of the electric energy meter by using the protocol conversion layer, and convert the first coded information into the second coded information of the electric energy meter.
[0165] In some optional implementations, the conversion module 703 includes:
[0166] A determination unit, used to determine the type of upper-level communication protocol;
[0167] The conversion unit is used to use the protocol conversion layer to search the table address corresponding to the object data descriptor of the first data identifier and the first coding information in the conversion table based on the upper communication protocol type, and generate the second data identifier and second coding information of the electric energy meter based on the corresponding table address.
[0168] The electric energy meter data conversion device also includes:
[0169] The first setting module is used to set the second data identification byte and the first rule table corresponding to each byte. The second data identification byte includes a belonging module byte, an internal offset number byte and a row number byte, and the first rule table corresponding to each byte includes: a belonging module number table, an internal offset number table and a row number table.
[0170] The second setting module is used to set the second coding information byte and the second rule table corresponding to each byte. The second coding information byte includes a judgment coding type byte, a complex type byte or a basic type byte, and the second rule table corresponding to each byte includes: a judgment coding type table, a complex type coding table and a basic type coding table.
[0171] A generating module is used to generate a conversion table based on the second data identification byte, the first rule table, the second encoding information byte and the second rule table.
[0172] In some optional implementations, the generation module includes:
[0173] The first generating unit is used to generate a three-level table based on the judgment coding type table, the complex type coding table and the basic type coding table.
[0174] The second generating unit is used to generate a secondary table based on the internal offset number table, the row number table and the tertiary table address, wherein the secondary table includes the tertiary table addresses corresponding to the low bytes of different object identifiers.
[0175] The third generating unit is used to generate a primary table based on the secondary table address and the belonging module number table; the primary table includes secondary table addresses corresponding to high bytes of different object identifiers.
[0176] The fourth generating unit is used to generate a conversion table based on the primary table, the secondary table and the tertiary table.
[0177] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0178] The electric energy meter data conversion device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0179] The embodiment of the present invention also provides a computer device having the above Figure 7 The electric energy meter data conversion device shown.
[0180] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.
[0181] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0182] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0183] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0184] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0185] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0186] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device may be a touch screen.
[0187] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0188] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for converting electric energy meter data, characterized in that: The electric energy meter includes a protocol conversion layer, and the method includes: Receive data frames sent by the superior communication protocol; Acquire a first data identifier and first encoding information of a communication protocol in the data frame; the first data identifier is represented by an object data descriptor of preset bytes, the object data descriptor includes an object identifier, an attribute identifier and its characteristics and an element index within the attribute, and the object identifier includes a high byte and a low byte; Using a protocol conversion layer to convert the first data identifier into a second data identifier of the electric energy meter, and convert the first coded information into second coded information of the electric energy meter; Before converting the first data identifier into a second data identifier of the electric energy meter using a protocol conversion layer, the method further includes: Set the second data identification byte and the first rule table corresponding to each byte; Setting the second encoding information byte and the second rule table corresponding to each byte; Generate a conversion table based on the second data identification byte, the first rule table, the second encoding information byte, and the second rule table; The second data identification byte includes a belonging module byte, an internal offset number byte and a row number byte, and the first rule table corresponding to each byte includes: a belonging module number table, an internal offset number table and a row number table; The second coding information byte includes a judgment coding type byte, a complex type byte or a basic type byte, and the second rule table corresponding to each byte includes: a judgment coding type table, a complex type coding table and a basic type coding table; Generating a conversion table based on the second data identification byte, the first rule table, the second encoding information byte and the second rule table includes: Generate a three-level table based on the judgment coding type table, the complex type coding table and the basic type coding table; Generate a secondary table based on the internal offset number table, the row number table and the third-level table address, wherein the secondary table includes the third-level table addresses corresponding to the low bytes of different object identifiers; Generate a primary table based on the secondary table address and the belonging module number table; the primary table includes secondary table addresses corresponding to high bytes of different object identifiers; A conversion table is generated based on the primary table, the secondary table, and the tertiary table.
2. The method according to claim 1, characterized in that The method of converting the first data identifier into a second data identifier of the electric energy meter by using a protocol conversion layer, and converting the first coded information into the second coded information of the electric energy meter comprises: Determine the type of upper-level communication protocol; Based on the upper communication protocol type, a protocol conversion layer is used to search the conversion table for a table address corresponding to the object data descriptor of the first data identifier and the first coding information, and a second data identifier and a second coding information of the electric energy meter are correspondingly generated based on the corresponding table address.
3. The method according to claim 2, characterized in that The method of using a protocol conversion layer to search the conversion table for an object data descriptor corresponding to the first data identifier and the first coding information based on the upper communication protocol type, and generating a second data identifier and a second coding information of the electric energy meter based on the corresponding table address includes: The protocol conversion layer is used to search the primary table based on the high byte of the object identifier to obtain the secondary table address and the module byte corresponding to the high byte of the object identifier; Search the secondary table based on the secondary table address and the low byte of the object identifier to obtain the third-level table address, internal offset number byte and row number byte corresponding to the low byte of the object identifier; Search the third-level table based on the third-level table address and attribute identifier and its characteristics to obtain the corresponding attribute and corresponding coding information; The second data identifier and the second coding information of the electric energy meter are generated based on the belonging module byte, the internal offset number byte, the row number byte, the corresponding attribute, the element index within the attribute and the coding information.
4. The method according to claim 1, characterized in that: The electric energy meter further includes a plurality of functional modules, and the method further includes: The second data identifier and the second coding information are forwarded to the corresponding functional module for data application.
5. An electric energy meter data conversion device, characterized in that: The electric energy meter includes a protocol conversion layer, and the device includes: A receiving module, used for receiving data frames sent by the communication protocol; an acquisition module, configured to acquire a first data identifier and first encoding information of a communication protocol in the data frame; the first data identifier is represented by an object data descriptor of preset bytes, the object data descriptor includes an object identifier, an attribute identifier and its characteristics and an element index within the attribute, and the object identifier includes a high byte and a low byte; A conversion module, configured to convert the first data identifier into a second data identifier of the electric energy meter by using a protocol conversion layer, and convert the first coded information into second coded information of the electric energy meter; The electric energy meter data conversion device also includes: A first setting module is used to set the second data identification byte and the first rule table corresponding to each byte; the second data identification byte includes a belonging module byte, an internal offset number byte and a row number byte, and the first rule table corresponding to each byte includes: a belonging module number table, an internal offset number table and a row number table; A second setting module is used to set the second coding information byte and the second rule table corresponding to each byte; the second coding information byte includes a judgment coding type byte, a complex type byte or a basic type byte, and the second rule table corresponding to each byte includes: a judgment coding type table, a complex type coding table and a basic type coding table; A generating module, configured to generate a conversion table based on the second data identification byte, the first rule table, the second encoding information byte, and the second rule table; The generated modules include: A first generating unit, used for generating a three-level table based on the judgment coding type table, the complex type coding table and the basic type coding table; A second generating unit is used to generate a secondary table based on the internal offset number table, the row number table and the third-level table address, wherein the secondary table includes the third-level table addresses corresponding to the low bytes of different object identifiers; The third generating unit is used to generate a primary table based on the secondary table address and the belonging module number table; the primary table includes secondary table addresses corresponding to high bytes of different object identifiers; The fourth generating unit is used to generate a conversion table based on the primary table, the secondary table and the tertiary table.
6. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the electric energy meter data conversion method according to any one of claims 1 to 4 by executing the computer instructions.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the electric energy meter data conversion method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Protocol conversion system and protocol conversion process
CN101277299A
Intelligent protocol conversion device
CN108364454A
Multi-protocol management method for intelligent electric meter
CN111866021A
Ammeter data proxy reading method and device, electronic equipment and storage medium
CN116828346A
Device for transmitting at least one piece of environmental information about the environment of a meter with a pulse output to a smart meter gateway
DE102021127109A1
