An electric energy meter communication method and device, computer equipment and medium
Patent Information
- Application Number
- CN202310189414.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-02-21
AI Technical Summary
由于RS485是半双工通讯方式,是单主网络,在现有的通信网络中,采集器为主机,电能表为从机,从机没法实现主动上报功能
[0006]有益效果为:电能表中配置有控制器局域网络模块,控制器局域网络模块上运行着的控制器局域网络总线应用层协议,控制器局域网络模块接收携带有事件信息的上报请求帧并将其拆分,依次将拆分得到的各数据包发送给采集器,从而实现电能表的自动上报,控制器局域网络总线是多主网络,电网中的任何一台设备(电能表或者采集器)都可以主动发送数据,并且,通讯速率快,控制器局域网络总线的吞吐能力强,更方便实现电能表的主动上报功能。
Smart Images

Figure CN116192560B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic energy meters, and more specifically to an energy meter communication method, device, computer equipment, and medium. Background Technology
[0002] Stable, reliable, and real-time communication is a crucial component of the normal operation of a smart grid, directly impacting its overall performance. In current smart grids consisting of data collectors and electricity meters, the primary communication methods for information transmission are RS485 or carrier wave communication. When an electricity meter experiences operational abnormalities or changes in its monitoring status, it needs to proactively report the event information to the data collector. However, because RS485 is a half-duplex communication method and operates on a single-master network, in existing communication networks, the data collector acts as the master and the electricity meter as the slave; the slave cannot proactively report the event.
[0003] Therefore, how to solve the problem of electricity meters actively reporting has become a technical problem that urgently needs to be solved and a key research focus for those skilled in the art. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a communication method, device, computer equipment, and medium for electricity meters.
[0005] The first aspect of this invention provides a communication method for an electricity meter, applied to a controller local area network (CLAN) module in the electricity meter. The CLAN module runs a controller local area network bus application layer protocol, comprising: receiving a reporting request frame sent by the microcontroller unit of the electricity meter, the reporting request frame carrying event information; splitting the reporting request frame into multiple sub-data, forming multiple data packets based on each sub-data, the length of each sub-data being less than or equal to a preset number of bytes; and sequentially sending each data packet to a data collector via the controller local area network bus, so that the data collector can obtain event information based on each data packet.
[0006] The beneficial effects are as follows: The electricity meter is equipped with a controller local area network (CLAN) module, which runs the CLAN bus application layer protocol. The CLAN module receives and splits the reporting request frames carrying event information, and sends the split data packets to the data collector in sequence, thereby realizing the automatic reporting of the electricity meter. The CLAN bus is a multi-master network, and any device in the power grid (electricity meter or data collector) can actively send data. In addition, the communication speed is fast and the throughput of the CLAN bus is strong, making it easier to realize the active reporting function of the electricity meter.
[0007] In conjunction with the first aspect, in the first embodiment of the first aspect, the controller local area network module is equipped with a timer to determine the duration of the controller local area network bus in an idle state; when the duration of the controller local area network bus in an idle state is longer than a preset value, the step of sequentially sending each data packet to the collector through the controller local area network bus is executed.
[0008] The beneficial effect is that the controller local area network module is equipped with a timer, which determines whether the controller local area network bus is in an idle state based on the timer's time, thus avoiding errors in the data packet transmission process.
[0009] In conjunction with the first embodiment of the first aspect, in the second embodiment of the first aspect, the method of sequentially sending the split reporting request frames to the controller local area network bus is as follows: if the first data packet is successfully sent, the remaining data packets are sent sequentially; if the first data packet fails to be sent, it indicates that the controller local area network bus is busy, and when the timer determines that the duration of the controller local area network bus being in an idle state is greater than a preset value, each data packet is resent.
[0010] In conjunction with the first aspect, in the third embodiment of the first aspect, the event information is information about abnormal situations when the electricity meter experiences operational abnormalities or changes in its detection status, including any one of the following: the meter cover being opened, the meter battery malfunctioning, the meter overvoltage, and the meter overload.
[0011] In conjunction with the first aspect, in the fourth embodiment of the first aspect, the data packet also includes ID number information, which includes sender ID, receiver ID, subsequent frame flag, and broadcast flag.
[0012] The beneficial effects are: the data packet includes ID information, and the type of data packet and subsequent operations are determined by the ID signal, making the transmission results more accurate.
[0013] In conjunction with the fourth embodiment of the first aspect, in the fifth embodiment of the first aspect, among the multiple data packets formed by splitting the reporting request frame, the subsequent frame flag in the last data packet is a first preset value, and the subsequent frame flag in the remaining data packets is a second preset value. The first preset value is used to indicate that the data packet does not have a subsequent frame, and the second preset value is used to indicate that the data packet has a subsequent frame.
[0014] In conjunction with the fourth embodiment of the first aspect, in the sixth embodiment of the first aspect, before the step of receiving the reporting request frame sent by the microcontroller unit of the energy meter, the method further includes: sending an access request frame to the collector via a controller local area network bus; receiving an access response frame, wherein the access response frame contains an ID number assigned by the collector to the energy meter, and when forming a data packet based on the sub-data, the ID number of the collector is used as the sender ID in the data packet.
[0015] The beneficial effect is that the access response frame contains the ID number assigned to the energy meter by the collector, thereby determining the sender ID in the data packet.
[0016] In conjunction with the fourth embodiment of the first aspect, the seventh embodiment of the first aspect further includes: receiving data packets via a controller local area network bus; if the data packet is determined to be broadcast data based on the broadcast flag in the data packet, the data packet is retained; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is the same as the ID of the energy meter, the data packet is retained; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is different from the ID of the energy meter, the data packet is discarded.
[0017] In conjunction with the seventh embodiment of the first aspect, in the eighth embodiment of the first aspect, multiple data packets are sequentially spliced together until the subsequent frame flag in the data packet is a first preset value, forming a complete data frame. The first preset value is used to indicate that the data packet does not have a subsequent frame.
[0018] The beneficial effect is that when the subsequent frame flag in the last data packet is set to the first set value, it means that the data packet does not have a subsequent frame and the data packet is completely spliced.
[0019] A second aspect of the present invention provides a communication device for an electricity meter, applied to a controller local area network module in an electricity meter, comprising: a receiving module for receiving a reporting request frame sent by the microcontroller unit of the electricity meter, the reporting request frame carrying event information; a splitting module for splitting the reporting request frame into multiple sub-data, and forming multiple data packets according to each sub-data, the length of the sub-data being less than or equal to a preset number of bytes; and a sending module for sequentially sending each data packet to a data collector via a CAN bus, so that the data collector can obtain event information according to each data packet.
[0020] The beneficial effects are as follows: The electricity meter is equipped with a controller local area network (CLAN) module, which runs the CLAN bus application layer protocol. The CLAN module receives and splits the reporting request frames carrying event information, and sends the split data packets to the data collector in sequence, thereby realizing the automatic reporting of the electricity meter. The CLAN bus is a multi-master network, and any device in the power grid (electricity meter or data collector) can actively send data. In addition, the communication speed is fast and the throughput of the CLAN bus is strong, making it easier to realize the active reporting function of the electricity meter.
[0021] A third aspect of the present invention provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to perform the electricity meter communication method of any one of the first aspects and its optional embodiments.
[0022] A fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the electricity meter communication method of any one of the first aspect and its optional embodiments. Attached Figure Description
[0023] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention.
[0024] Figure 1 A flowchart of the electricity meter communication method provided in an embodiment of the present invention is shown;
[0025] Figure 2 A block diagram of the CAN circuit of the device provided in an embodiment of the present invention is shown;
[0026] Figure 3 A block diagram of a CAN bus system provided in an embodiment of the present invention is shown;
[0027] Figure 4 A schematic diagram of the electricity meter communication device provided in an embodiment of the present invention is shown;
[0028] Figure 5 This diagram illustrates a hardware structure of a computer device according to an embodiment of the present invention.
[0029] Figure 6 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present invention is shown. Detailed Implementation
[0030] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] In the description of this invention, it should be noted that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0032] This invention provides a communication method for an electricity meter, applied to the Controller Area Network (CAN) module of the electricity meter. The CAN module runs a CAN bus application layer protocol, such as... Figure 1 As shown, the method includes the following steps:
[0033] Step S001: Receive a reporting request frame sent by the microcontroller unit (MCU) of the electricity meter. The reporting request frame carries event information.
[0034] In one optional embodiment, the event information is information about abnormal situations when the electricity meter experiences operational abnormalities or changes in its detection status, including any one of the following: the meter cover being opened, the meter battery malfunctioning, the meter overvoltage, and the meter overload.
[0035] In an alternative embodiment, such as Figure 2 The diagram shows the CAN circuit principle block diagram of the device (data collector or energy meter), including the device MCU and CAN module. The device MCU is connected to the CAN module through UART. The CAN module includes a CPU and a CAN transceiver. The CPU has a built-in CAN controller. The CAN controller is connected to the CAN transceiver through two lines, CAN_TX and CAN_RX. The CAN transceiver has two lines, CAN_H and CAN_L.
[0036] In an alternative embodiment, such as Figure 3 The diagram shows a CAN bus system block diagram, which includes a data acquisition unit with a CAN module and an energy meter with a CAN module. Each device is integrated into the CAN bus through the CAN_H and CAN_L lines of the CAN module. There is a 120Ω resistor at each end of the CAN bus.
[0037] In an optional embodiment, for example, a certain energy meter on the CAN bus has a communication address of 000000000009. At a certain moment, the MCU of the energy meter detects a power failure event and sends a reporting request frame to the CPU of the CAN module via UART. According to the DL / T645 protocol, the reporting request frame is shown in Table 1, with a total length of 47 bytes.
[0038] Table 1: Reporting request frames in embodiments of the present invention.
[0039] 68H 09H 00H 00H 00H 00H 00H 68H 06H L N1 … Nm CS 16H
[0040] In one optional embodiment, the CAN bus has five frame types: data frame, remote frame, error frame, overload frame, and interval frame. This embodiment of the invention only uses data frames. Data frames are divided into standard frames (2.0A) and extended frames (2.0B) according to the different arbitration segment lengths. The ID of the extended frame of CAN is 29 bits, and the ID of the standard frame is 11 bits. According to the method provided in this embodiment of the invention, extended frames (2.0B) are used.
[0041] Step S002: The reporting request frame is split into multiple sub-data, and multiple data packets are formed based on each sub-data. The length of each sub-data is less than or equal to a preset number of bytes. In this embodiment of the invention, one sub-data forms one data packet.
[0042] In one optional embodiment, the MCU on the energy meter uses the DL / T698.45 or DL / T645 protocol for transmission, and the CAN module on the energy meter communicates with the data collector via the CAN bus application layer protocol. The DL / T698.45 or DL / T645 protocol can transmit many bytes of data at a time, while the CAN bus can only transmit 8 bytes of data at a time. Therefore, the reporting request frame needs to be split into multiple sub-data, and each sub-data is used to form multiple data packets, with the length of each sub-data being less than or equal to 8 bytes.
[0043] In one alternative embodiment, for example, the CAN bus can only send a maximum of 8 bytes of data at a time, and 47 bytes of data need to be sent in 6 separate transmissions.
[0044] In an optional embodiment, DL / T698.45 or DL / T645 is a communication protocol with functions including reading, writing, operation, time synchronization, and zeroing.
[0045] Step S003: Send each data packet to the collector sequentially via the CAN bus so that the collector can obtain event information based on each data packet.
[0046] In one optional embodiment, after receiving data, the CAN module on the data collector compares the receiver's ID with its own ID, concatenates the six received data packets, and sends them to the data collector's MCU for data processing. However, if the CAN module of other energy meters receives the data packets and finds a discrepancy between the receiver's ID and its own ID, it will discard the data.
[0047] The electricity meter communication method provided in this embodiment of the invention includes a controller local area network (CLAN) module in the electricity meter. The CLAN module runs a controller local area network bus application layer protocol. The CLAN module receives and splits a reporting request frame carrying event information, and sequentially sends each split data packet to a data collector, thereby realizing automatic reporting by the electricity meter. The controller local area network bus is a multi-master network, allowing any device in the power grid (electricity meter or data collector) to actively send data. Furthermore, the communication speed is fast, and the throughput capacity of the controller local area network bus is strong, making it easier to realize the active reporting function of the electricity meter.
[0048] In one optional embodiment, the controller local area network module is configured with a timer to determine the duration for which the controller local area network bus is in an idle state.
[0049] When the duration of the controller local area network bus being idle exceeds a preset value, the step of sequentially sending each data packet to the collector via the controller local area network bus is executed.
[0050] In one optional embodiment, the CPU of the CAN module defines a counter TimeCNT. TimeCNT equals 10, indicating that the CAN bus is idle and data transmission can be started. TimeCNT is less than 10, indicating that the CAN bus is busy and data transmission cannot be started. TimeCNT is initialized to 0 upon power-on and increments by 1 every 1ms, up to a maximum of 10.
[0051] In one optional embodiment, when the CAN module receives a data packet sent by another device on the CAN bus, if ID4 is 1, it means there are subsequent frames, and TimeCNT is set to 0, indicating that it cannot send and must wait until the other device on the CAN bus has finished sending the data packet before sending can begin; if ID4 is 0, it means there are no subsequent frames, and TimeCNT is set to 10, and sending can begin.
[0052] In one optional embodiment, the CAN bus is considered idle only if there is no data transmission on the CAN bus for more than 10ms or if a data packet without a subsequent frame is received. Other devices can then start sending. If there is a subsequent frame, the subsequent frame data should be sent within 9ms.
[0053] In an optional embodiment, the method for sequentially sending the split reporting request frames to the controller local area network bus is as follows:
[0054] If the first data packet is sent successfully, the remaining data packets will be sent in sequence.
[0055] If the first data packet fails to be sent, it indicates that the Controller Area Network (CAN) bus is busy. When the timer determines that the CAN bus has been idle for a longer period than a preset value, each data packet is resent.
[0056] In one optional embodiment, due to the contention during CAN bus transmission, the first transmission may fail. After failure, the system immediately switches to receive mode and restarts transmission when TimeCNT equals 10.
[0057] In an optional embodiment, to prevent ID number conflicts, the ID numbers of different devices are specified as shown in Table 2 below.
[0058] Table 2: Definition of Device ID Number Allocation on CAN Bus.
[0059] Collector 1 other 2-20 reserved Electricity meter 21 and above
[0060] In an optional embodiment, the data packet also includes ID number information, which includes sender ID, receiver ID, subsequent frame flag, and broadcast flag.
[0061] In an optional embodiment, the CAN bus application layer protocol uses the CAN Extended Frame (2.0B) 29-bit ID. The frame ID length of the CAN Extended Frame is 29 bits, as shown in Table 3. ID28-ID17 are the sender ID numbers, ID16-ID5 are the receiver ID numbers, ID4 is the follow-up frame flag (0 indicates no follow-up frame, 1 indicates a follow-up frame), ID3 is the broadcast flag (1 indicates broadcast, otherwise it indicates sending to the device with the specified ID); in non-broadcast mode, the device's CAN controller only processes data with matching IDs; otherwise, the received data is discarded. ID2 indicates the frame direction (0 indicates a send request frame, 1 indicates a response frame). ID2-ID0 functions are reserved.
[0062] Table 3: CAN Extended Frame (2.0B) 29-bit ID.
[0063] ID28-ID17 ID16-ID5 ID4 ID3 ID2 ID1~ID0
[0064] In an optional embodiment, among the multiple data packets formed by splitting the reporting request frame, the subsequent frame flag in the last data packet is a first preset value, and the subsequent frame flag in the remaining data packets is a second preset value. The first preset value is used to indicate that the data packet does not have a subsequent frame, and the second preset value is used to indicate that the data packet has a subsequent frame.
[0065] In one alternative embodiment, the first setting value is 0 and the second setting value is 1.
[0066] In an optional embodiment, if the reporting request frame is split into 6 data packets for transmission, in each data packet, ID28-17 is filled with the sender's ID number, i.e., the ID number of this CAN module, 0x100; ID16-5 is filled with the receiver's ID number. Since this reporting request frame is sent to the data collector, and the data collector's ID number is specified as 1 in Table 2, ID16-5 is filled with 0x001. ID4 is filled with 1 in the first 5 data packets, indicating that there is a subsequent frame, and filled with 0 in the 6th data packet, indicating that there is no subsequent frame. The data packets are sent sequentially. Because the reporting request frame is to be sent to the data collector rather than broadcast, ID3 in each data packet is filled with 0, and ID2 is filled with 0 because it is a request frame. During these 6 transmissions, all devices on the CAN bus will receive the data.
[0067] In one optional embodiment, after receiving and retaining a data packet, the CAN module sequentially splices the multiple retained data packets until the subsequent frame flag in the data packet is set to a first preset value, thus forming a complete data frame. The first preset value is used to indicate that the data packet does not have a subsequent frame.
[0068] In an optional embodiment, prior to the step of receiving a reporting request frame sent by the microcontroller unit of the energy meter, the method further includes:
[0069] First, an access request frame is sent to the data collector via the controller local area network bus.
[0070] Secondly, the access response frame is received. The access response frame contains the ID number assigned by the collector to the energy meter. When forming a data packet based on the sub-data, the collector's ID number is used as the sender ID in the data packet.
[0071] In one optional embodiment, each device in the smart grid has a unique ID number, which serves as an identifier for each device. The ID number is 12 bits long. New energy meters can be flexibly connected, and the default ID number of a new energy meter is all 1s. When a new energy meter is connected, the energy meter's MCU actively reports a custom access request frame conforming to the DL / T698.45 or DL / T645 protocol to the CAN bus to notify the data collector. The data collector performs energy meter ID number allocation and file management, and returns an access response frame to the new energy meter. The energy meter parses the ID number in the access response frame as its own ID number.
[0072] In an optional embodiment, the electricity meter communication method further includes:
[0073] When receiving data packets via the Controller Area Network (CAN) bus, if the data packet is determined to be broadcast data based on the broadcast flag in the data packet, the data packet is retained; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is the same as the energy meter's ID, the data packet is retained; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is different from the energy meter's ID, the data packet is discarded.
[0074] In one optional embodiment, the data acquisition unit (MCU) sends a response frame to the energy meter via UART, the CAN module of the data acquisition unit, and the CAN bus, as shown in Table 4 below. The frame is 20 bytes long and is sent in three parts. IDs 28-17 are filled with the sender's ID (0x001), IDs 16-5 are filled with the receiver's ID (0x100), ID4 is filled with 1 in the first two transmissions and 0 in the third transmission, ID3 is filled with 0, and ID2 is filled with 1. The energy meter with CAN module ID 0x100 concatenates the three received data packets and sends them to its MCU. This allows the MCU to know that the data acquisition unit has correctly received the reporting request frame.
[0075] Table 4: Response frames provided in the embodiments of the present invention.
[0076] 68H 09H 00H 00H 00H 00H 00H 68H 06H L D1 … Di CS 16H
[0077] In one optional embodiment, the MCU of the electricity meter receives a response frame and parses it. For example, if the parsing result is a command to clear the electricity meter, then the electricity meter clears all its internal data and returns the result to the data collector. If the parsing result is a current reading command, then the MCU of the electricity meter returns the current value to the data collector.
[0078] This invention provides a communication device for an electricity meter, applied to the controller local area network module of an electricity meter, such as... Figure 4 As shown, it includes:
[0079] The receiving module 401 is used to receive the reporting request frame sent by the microcontroller unit of the electricity meter. The reporting request frame carries event information. For details, please refer to the description of step S001 in the above embodiment, which will not be repeated here.
[0080] The splitting module 402 is used to split the reporting request frame into multiple sub-data, and form multiple data packets according to each sub-data. The length of the sub-data is less than or equal to a preset number of bytes. For details, please refer to the description of step S002 in the above embodiment, which will not be repeated here.
[0081] The sending module 403 is used to send each data packet to the collector sequentially via the CAN bus, so that the collector can obtain event information based on each data packet. For details, please refer to the description of step S003 in the above embodiment, which will not be repeated here.
[0082] In the electricity meter communication device provided in this embodiment of the invention, the electricity meter is equipped with a controller local area network (CLAN) module. The CLAN module runs a controller local area network bus application layer protocol. The CLAN module receives a reporting request frame carrying event information and splits it. It then sends each of the split data packets to the data collector in sequence, thereby realizing the automatic reporting of the electricity meter. The controller local area network bus is a multi-master network, and any device in the power grid (electricity meter or data collector) can actively send data. Furthermore, the communication speed is fast, the throughput of the controller local area network bus is strong, and it is more convenient to realize the active reporting function of the electricity meter.
[0083] This invention also provides a computer device, such as... Figure 5 This is a schematic diagram of the hardware structure of a computer device according to an exemplary embodiment.
[0084] like Figure 5 As shown, the device includes one or more processors 501 and a memory 502, the memory 502 including persistent memory, volatile memory, and a hard disk. Figure 5 Taking a processor 501 as an example, the device may also include an input device 503 and an output device 504.
[0085] The processor 501, memory 502, input device 503, and output device 504 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0086] Processor 501 can be a Central Processing Unit (CPU). Processor 501 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof. The general-purpose processor can be a microprocessor or any conventional processor.
[0087] The memory 502, as a non-transitory computer-readable storage medium, includes persistent memory, volatile memory, and a hard disk. It can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instruction module corresponding to the business management method in this embodiment. The processor 501 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions, and modules stored in the memory 502, thereby implementing any of the above-mentioned electricity meter communication methods.
[0088] Memory 502 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data that is needed and required. Furthermore, memory 502 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 502 may optionally include memory remotely located relative to processor 501, and these remote memories can be connected to the data processing device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0089] Input device 503 can receive input digital or character information, and generate key signal inputs related to user settings and function control. Output device 504 may include display devices such as a display screen.
[0090] One or more modules are stored in memory 502, and when executed by one or more processors 501, they perform actions such as... Figure 1 The method shown.
[0091] The above-described product can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in [reference 1]. Figure 1 The relevant descriptions in the illustrated embodiments.
[0092] This invention also provides a computer-readable storage medium, such as... Figure 6 As shown, a computer-readable storage medium stores computer-executable instructions 601, which can execute the electricity meter communication method in any of the above method embodiments.
[0093] Storage media can be magnetic disks, optical disks, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drives (HDDs), or solid-state drives (SSDs), etc.; storage media can also include combinations of the above types of memory.
[0094] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A communication method for an electricity meter, characterized in that, A controller local area network (CLAN) module applied to an energy meter, wherein a controller local area network bus application layer protocol runs on the CLAN module, the method comprising: The system receives a reporting request frame from the microcontroller unit of the electricity meter. This reporting request frame carries event information, including any one of the following: meter cover opening, meter battery failure, meter overvoltage, and meter overload. The MCU on the electricity meter uses the DL / T698.45 or DL / T645 protocol for transmission. The Controller Area Network (CAN) bus application layer protocol uses a 29-bit extended CAN frame ID, where the frame ID length is 29 bits. The DL / T698.45 or DL / T645 protocol transmits multiple bytes of data at a time, while the CAN bus transmits 8 bytes of data at a time. Before the step of receiving the reporting request frame sent by the microcontroller unit of the electricity meter, the method further includes: sending an access request frame to the collector via the controller local area network bus; receiving an access response frame, wherein the access response frame contains an ID number assigned by the collector to the electricity meter, and when forming a data packet based on sub-data, the ID number of the collector is used as the sender ID in the data packet; The reporting request frame is split into multiple sub-data, and multiple data packets are formed based on each sub-data. The length of each sub-data is less than or equal to a preset number of bytes. In the multiple data packets formed by splitting the reporting request frame, the subsequent frame flag in the last data packet is a first preset value, and the subsequent frame flag in the remaining data packets is a second preset value. The first preset value is used to indicate that the data packet does not have a subsequent frame, and the second preset value is used to indicate that the data packet has a subsequent frame. Each of the data packets is sent to the collector sequentially via the controller local area network bus, so that the collector can obtain the event information based on each of the data packets; The method for sending the split reporting request frames to the controller local area network bus in sequence is as follows: if the first data packet is sent successfully, the remaining data packets are sent in sequence; if the first data packet fails to be sent, it indicates that the controller local area network bus is busy. When the timer determines that the duration of the controller local area network bus being idle is longer than a preset value, each data packet is resent. The electricity meter communication method further includes: receiving data packets via a controller local area network bus; if the data packet is determined to be broadcast data based on the broadcast flag in the data packet, the data packet is retained; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is the same as the ID of the electricity meter, the data packet is retained; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is different from the ID of the electricity meter, the data packet is discarded. The method further includes: sequentially concatenating multiple retained data packets until the subsequent frame flag in the data packet is set to a first preset value to form a complete data frame, wherein the first preset value is used to indicate that the data packet does not have a subsequent frame.
2. The communication method for an electricity meter according to claim 1, characterized in that, The controller local area network module is equipped with a timer, which determines the duration of the controller local area network bus being in an idle state. When the duration of the controller local area network bus being idle exceeds a preset value, the step of sequentially sending each data packet to the collector via the controller local area network bus is executed.
3. The communication method for an electricity meter according to claim 1, characterized in that, The data packet also includes ID information, which includes sender ID, receiver ID, subsequent frame flag, and broadcast flag.
4. A communication device for an electricity meter, applied to a controller local area network module in an electricity meter, characterized in that, include: The receiving module is used to receive a reporting request frame sent by the microcontroller unit of the electricity meter, wherein the reporting request frame carries event information; The event information includes any one of the following: meter cover opened, meter battery failure, meter overvoltage, and meter overload; the MCU on the electricity meter uses the DL / T698.45 or DL / T645 protocol for transmission; the Controller Area Network (CAN) bus application layer protocol uses CAN extended frame 29-bit ID, and the frame ID length of the CAN extended frame is 29 bits; the DL / T698.45 or DL / T645 protocol transmits multiple bytes of data at a time, while the CAN bus transmits 8 bytes of data at a time; Before the step of receiving the reporting request frame sent by the microcontroller unit of the electricity meter, the device further includes: sending an access request frame to the collector via the controller local area network bus; receiving an access response frame, wherein the access response frame contains an ID number assigned by the collector to the electricity meter, and when forming a data packet based on sub-data, the ID number of the collector is used as the sender ID in the data packet; The splitting module is used to split the reporting request frame into multiple sub-data, and form multiple data packets according to each sub-data. The length of the sub-data is less than or equal to a preset number of bytes. In the multiple data packets formed by splitting the reporting request frame, the subsequent frame flag in the last data packet is a first preset value, and the subsequent frame flag in the remaining data packets is a second preset value. The first preset value is used to indicate that the data packet does not have a subsequent frame, and the second preset value is used to indicate that the data packet has a subsequent frame. The sending module is used to sequentially send each of the data packets to the collector via the CAN bus, so that the collector can obtain the event information based on each of the data packets; the method for sequentially sending the split reporting request frames to the controller local area network bus is as follows: if the first data packet is sent successfully, the remaining data packets are sent sequentially; if the first data packet fails to be sent, it indicates that the controller local area network bus is busy, and when the timer determines that the duration of the controller local area network bus being in an idle state is greater than a preset value, each data packet is resent. The electricity meter communication device further includes: receiving data packets via a controller local area network bus; if the data packet is determined to be broadcast data based on the broadcast flag in the data packet, retaining the data packet; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is the same as the ID of the electricity meter, retaining the data packet; if the data packet is determined to be non-broadcast data based on the broadcast flag in the data packet, and the receiver ID in the data packet is different from the ID of the electricity meter, discarding the data packet; The device further includes: sequentially concatenating multiple retained data packets until the subsequent frame flag in the data packet is set to a first preset value to form a complete data frame, wherein the first preset value is used to indicate that the data packet does not have a subsequent frame.
5. A computer device, characterized in that, include: At least one processor; The device includes a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to perform the electricity meter communication method as described in any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the electricity meter communication method as described in any one of claims 1-3.
Citation Information
Patent Citations
NB-IoT-based intelligent electric meter power failure fault processing device and method
CN109885592A
Based on CAN communication cable type fault location device
CN207352111U