技术领域Technical field
本发明涉及电力系统自动化领域,特别是涉及一种基于多功能电能表通信规约的文件传输方法及装置。The invention relates to the field of power system automation, and in particular to a file transmission method and device based on a multifunctional electric energy meter communication protocol.
背景技术Background technique
DL/T 614-2007《多功能电能表》标准是为统一和规范电能表的多功能电能表与数据终端设备进行数据交换时的物理连接和协议。标准中规定了多功能电能表与手持单元(HHU)或其它数据终端设备之间的物理连接、通信链路及就用技术规范。适用于本地系统中多功能电能表与手持单元(HHU)或其他数据终端设备进行点对点的或一主多从的数据交换方式。其它具有通信功能的电能表,如单相电能表、多费率电能表,可参照选用。DL/T 614-2007 "Multifunctional Electric Energy Meter" standard is to unify and standardize the physical connection and protocol for data exchange between multifunctional electric energy meters and data terminal equipment. The standard stipulates the physical connection, communication link and usage technical specifications between the multi-function electric energy meter and the handheld unit (HHU) or other data terminal equipment. It is suitable for point-to-point or one-master-multi-slave data exchange between multi-function electric energy meters and handheld units (HHU) or other data terminal equipment in local systems. Other electric energy meters with communication functions, such as single-phase electric energy meters and multi-rate electric energy meters, can be selected by reference.
但是现有的电表通信协议中,无法进行文件传输。However, file transfer cannot be performed in the existing meter communication protocol.
发明内容Contents of the invention
为解决上述技术问题,本发明提供了一种基于多功能电能表通信规约的文件传输方法及装置,用于解决现有的电表通信协议中,无法进行文件传输的技术问题。In order to solve the above technical problems, the present invention provides a file transmission method and device based on a multifunctional electric energy meter communication protocol, which is used to solve the technical problem that file transmission cannot be performed in the existing electric meter communication protocol.
本发明解决其技术问题所采用的技术方案是:The technical solutions adopted by the present invention to solve the technical problems are:
本发明提供的一种基于多功能电能表通信规约的文件传输方法及装置,包括:The invention provides a file transmission method and device based on the multifunctional electric energy meter communication protocol, including:
在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;When requesting a file, send a request directory file frame to the target electric meter device to query the file name list in the specified directory in the target electric meter device;
在接收到来自所述目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧,其中,所述文件名列表基于所述请求目录文件帧生成,所述请求文件信息帧基于所述文件名列表生成;When receiving the file name list returned from the target electric meter device, send a request file information frame to the target electric meter device, wherein the file name list is generated based on the request directory file frame, and the request file information frame is based on the Generate a list of described file names;
在接收到来自所述目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧,其中,所述请求文件内容帧基于所述文件信息生成;When receiving the file information returned from the target electric meter device, sending a request file content frame to the target electric meter device, wherein the request file content frame is generated based on the file information;
在接收到来自所述目标电表设备返回的文件内容时,完成文件请求,其中,所述文件内容基于所述请求文件内容帧生成。Upon receiving file content returned from the target electric meter device, the file request is completed, wherein the file content is generated based on the request file content frame.
在本申请一实施例中,所述文件名列表、所述文件信息和所述文件内容均基于一帧数据或者多帧数据发送,每一帧数据均包含控制码,其中,In an embodiment of the present application, the file name list, the file information and the file content are all sent based on one frame of data or multiple frames of data, and each frame of data includes a control code, where,
向目标电表设备发送请求文件信息帧或者请求文件内容帧之前,还包括:Before sending the request file information frame or request file content frame to the target electric meter device, it also includes:
基于当前帧数据的控制码确定所述当前数据帧的后续帧,其中,所述当前帧数据为所述目标电表设备返回的数据帧;Determine the subsequent frame of the current data frame based on the control code of the current frame data, wherein the current frame data is the data frame returned by the target electric meter device;
在所述当前数据帧存在后续帧时,向目标电表设备发送请求后续帧;在接收到来自所述目标电表设备返回的数据帧时,将返回的数据帧作为当前数据帧,并返回至基于当前帧数据的控制码确定所述当前数据帧的后续帧,直至当前数据帧不存在后续帧时,完成文件名列表、文件信息或者文件内容的接收;When there is a subsequent frame in the current data frame, a request for a subsequent frame is sent to the target electric meter device; when a data frame returned from the target electric meter device is received, the returned data frame is used as the current data frame and returned to the current data frame based on the current data frame. The control code of the frame data determines the subsequent frame of the current data frame. When there is no subsequent frame in the current data frame, the reception of the file name list, file information or file content is completed;
在所述当前数据帧不存在后续帧时,完成文文件名列表、文件信息或者文件内容的接收。在本申请一实施例中,向目标电表设备发送请求目录文件帧之后,还包括:When there is no subsequent frame in the current data frame, receiving the file name list, file information or file content is completed. In an embodiment of the present application, after sending the request directory file frame to the target electric meter device, it also includes:
在接收到来自所述目标电表设备返回异常回复时,判定无对应目录,并结束文件请求。When receiving an abnormal reply from the target electric meter device, it is determined that there is no corresponding directory, and the file request is terminated.
本申请还提供另一种基于多功能电能表通信规约的文件传输方法,包括:This application also provides another file transmission method based on the multifunctional electric energy meter communication protocol, including:
在发送文件时,向目标电表设备发送文件信息帧;When sending a file, send a file information frame to the target meter device;
在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧,其中,所述第一信息确认帧基于所述文件信息帧生成;When receiving the first information confirmation frame returned from the target electric meter device, sending a file content frame to the target electric meter device, wherein the first information confirmation frame is generated based on the file information frame;
在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送,其中,所述第二信息确认帧基于所述文件内容帧生成。When receiving a second information confirmation frame returned from the target electric meter device, the file sending is completed, wherein the second information confirmation frame is generated based on the file content frame.
在本申请一实施例中,还包括:In an embodiment of this application, it also includes:
向目标电表设备发送文件内容帧的同时,向目标电表设备发送结束帧,以终止文件传输。While sending the file content frame to the target electric meter device, send an end frame to the target electric meter device to terminate the file transfer.
在本申请一实施例中,完成文件发送之后,还包括:In an embodiment of the present application, after completing the file sending, it also includes:
向目标电表设备发送写入确认帧,以使得所述目标电表设备写入文件;或者向目标电表设备发送撤销帧,以使得所述目标电表设备撤销文件。Send a write confirmation frame to the target electric meter device to cause the target electric meter device to write the file; or send a cancel frame to the target electric meter device to cause the target electric meter device to cancel the file.
本申请还提供一种基于多功能电能表通信规约的文件传输装置,包括:This application also provides a file transmission device based on the multifunctional electric energy meter communication protocol, including:
第一请求模块,用于在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;The first request module is used to send a request directory file frame to the target electric meter device when requesting a file, so as to query the file name list in the specified directory in the target electric meter device;
第二请求模块,用于在接收到来自所述目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧,其中,所述文件名列表基于所述请求目录文件帧生成,所述请求文件信息帧基于所述文件名列表生成;The second request module is configured to send a request file information frame to the target electric meter device when receiving a file name list returned from the target electric meter device, wherein the file name list is generated based on the request directory file frame, so The request file information frame is generated based on the file name list;
第三请求模块,用于在接收到来自所述目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧,其中,所述请求文件内容帧基于所述文件信息生成;A third request module, configured to send a request file content frame to the target electric meter device when receiving file information returned from the target electric meter device, wherein the request file content frame is generated based on the file information;
第四请求模块,用于在接收到来自所述目标电表设备返回的文件内容时,完成文件请求,其中,所述文件内容基于所述请求文件内容帧生成。The fourth request module is configured to complete the file request when receiving the file content returned from the target electric meter device, wherein the file content is generated based on the request file content frame.
本申请还提供另一种基于多功能电能表通信规约的文件传输装置,包括:This application also provides another file transmission device based on the multifunctional electric energy meter communication protocol, including:
第一发送模块,用于在发送文件时,向目标电表设备发送文件信息帧;The first sending module is used to send file information frames to the target electric meter device when sending files;
第二发送模块,用于在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧,其中,所述第一信息确认帧基于所述文件信息帧生成;The second sending module is configured to send a file content frame to the target electric meter device when receiving the first information confirmation frame returned from the target electric meter device, wherein the first information confirmation frame is generated based on the file information frame. ;
第三发送模块,用于在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送,其中,所述第二信息确认帧基于所述文件内容帧生成。The third sending module is configured to complete file sending when receiving a second information confirmation frame returned from the target electric meter device, wherein the second information confirmation frame is generated based on the file content frame.
本发明的优点:本发明的一种基于多功能电能表通信规约的文件传输方法及装置,在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;在接收到来自目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧;在接收到来自目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧;在接收到来自目标电表设备返回的文件内容时,完成文件请求。在发送文件时,向目标电表设备发送文件信息帧;在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧;在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送。本申请通过约定多功能电表之间的文件传输协议,实现多功能电表之间的文件传输。有利于设备检修及设备数据文件的获取保存。Advantages of the present invention: The present invention is a file transmission method and device based on the multifunctional electric energy meter communication protocol. When requesting a file, a request directory file frame is sent to the target electric meter device to query the files in the specified directory in the target electric meter device. name list; when receiving the file name list returned from the target electric meter device, send a request file information frame to the target electric meter device; when receiving the file information returned from the target electric meter device, send a request file content frame to the target electric meter device; Complete the file request upon receipt of the file contents returned from the target meter device. When sending a file, send a file information frame to the target electric meter device; when receiving the first information confirmation frame returned from the target electric meter device, send a file content frame to the target electric meter device; when receiving the first information confirmation frame from the target electric meter device; When the second information confirmation frame is returned, the file sending is completed. This application implements file transfer between multi-function meters by agreeing on a file transfer protocol between them. It is conducive to equipment maintenance and the acquisition and storage of equipment data files.
附图说明Description of drawings
图1为本申请一实施例中的基于多功能电能表通信规约的文件传输方法的运用场景图;Figure 1 is an application scenario diagram of the file transmission method based on the multifunctional electric energy meter communication protocol in an embodiment of the present application;
图2为本申请一实施例中的基于多功能电能表通信规约的文件请求方法的流程示意图;Figure 2 is a schematic flowchart of a file request method based on a multifunctional electric energy meter communication protocol in an embodiment of the present application;
图3为本申请一实施例中的基于多功能电能表通信规约的文件发送方法的流程示意图;Figure 3 is a schematic flowchart of a file sending method based on a multifunctional electric energy meter communication protocol in an embodiment of the present application;
图4为本申请一实施例中的文件名列表请求方法的流程示意图;Figure 4 is a schematic flowchart of a file name list requesting method in an embodiment of the present application;
图5为本申请一实施例中的请求文件内容流程示意图;Figure 5 is a schematic flow chart of request file content in an embodiment of the present application;
图6为本申请一实施例中的主站下发文件的流程示意图。Figure 6 is a schematic flowchart of the main station issuing files in an embodiment of the present application.
具体实施方式Detailed ways
为了加深对本发明的理解,下面将结合附图和实施例对本发明做进一步详细描述,该实施例仅用于解释本发明,并不对本发明的保护范围构成限定。In order to deepen the understanding of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and examples. The examples are only used to explain the present invention and do not limit the scope of protection of the present invention.
为了解决基于DL-T 645-2007_多功能电能表通信规约的设备之间无法传输文件的问题,本申请的目的在于提供基于DL-T 645-2007_多功能电能表通信规约的一种文件传输方法,通过增加文件传输相关的数据项,实现终端设备之间的文件传输,有利于设备检修及设备数据文件的获取保存。具体技术方案如下:In order to solve the problem that files cannot be transmitted between devices based on the DL-T 645-2007_Multifunctional Energy Meter Communication Protocol, the purpose of this application is to provide a file based on the DL-T 645-2007_Multifunctional Energy Meter Communication Protocol The transmission method realizes file transmission between terminal devices by adding data items related to file transmission, which is beneficial to equipment maintenance and the acquisition and preservation of equipment data files. The specific technical solutions are as follows:
实施例Example
图1为本申请一实施例中的一种基于多功能电能表通信规约的文件传输方法的运用场景图,如图1所示,通过主设备110和从设备120来实现文件传输,其中,主设备110和从设备120均为多功能智能电表。主设备110和从设备120基于DL-T 645-2007通信规约进行数据传输。Figure 1 is an application scenario diagram of a file transmission method based on a multifunctional electric energy meter communication protocol in an embodiment of the present application. As shown in Figure 1, file transmission is implemented through a master device 110 and a slave device 120, where the master device Both the device 110 and the slave device 120 are multi-functional smart meters. The master device 110 and the slave device 120 perform data transmission based on the DL-T 645-2007 communication protocol.
图2为本申请一实施例中的一种基于多功能电能表通信规约的文件请求方法的流程示意图,如图2所示,本发明中的提供的一种基于多功能电能表通信规约的文件请求方法,以下方法代入主设备进行数据传输,具体步骤包括:Figure 2 is a schematic flowchart of a file request method based on a multifunctional electric energy meter communication protocol in an embodiment of the present application. As shown in Figure 2, the present invention provides a file based on a multifunctional electric energy meter communication protocol. Request method, the following method is used to transfer data to the main device. The specific steps include:
S210,在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;S210, when requesting a file, send a request directory file frame to the target electric meter device to query the file name list in the specified directory in the target electric meter device;
其中,目标电表设备为从设备,主设备在请求文件时,构建请求目录文件帧并发送至从设备,以查询对应的文件名列表。例如,主方设备发送请求目录下文件帧(0x0E0E0E01),查询从方设备指定目录下的文件名列表。Among them, the target electric meter device is a slave device. When requesting a file, the master device constructs a request directory file frame and sends it to the slave device to query the corresponding file name list. For example, the master device sends a request file frame (0x0E0E0E01) in the directory to query the list of file names in the directory specified by the slave device.
由于本申请中的数据传输是单帧数据传输,从设备返回的数据有可能大于单帧的数据量。因此从设备在接收到请求目录文件帧后,会存在如下三种情况:(1)直接返回单帧数据的文件名列表;(2)以多帧数据的形式返回文件名列表;(3)无对应的文件名列表,返回异常信息。详细过程如下:Since the data transmission in this application is a single frame data transmission, the data returned from the device may be larger than the data amount of a single frame. Therefore, after the slave device receives the request directory file frame, there will be the following three situations: (1) Directly return the file name list of single frame data; (2) Return the file name list in the form of multi-frame data; (3) None The corresponding file name list returns exception information. The detailed process is as follows:
基于当前帧数据的控制码确定所述当前数据帧的后续帧,其中,所述当前帧数据为所述目标电表设备返回的数据帧;其中,每一个帧都会包含控制码、数据长度、数据本身。控制码可以用于反应当前帧数据是否存在后续帧。The subsequent frames of the current data frame are determined based on the control code of the current frame data, where the current frame data is the data frame returned by the target electric meter device; where each frame will include a control code, data length, and data itself. . The control code can be used to reflect whether there are subsequent frames in the current frame data.
(1)在所述当前数据帧存在后续帧时,向目标电表设备发送请求后续帧;在接收到来自所述目标电表设备返回的数据帧时,将返回的数据帧作为当前数据帧,并返回至基于当前帧数据的控制码确定所述当前数据帧的后续帧,直至当前数据帧不存在后续帧时,完成文件名列表的接收;在存在后续帧的情况下,主设备继续进行逐帧请求,直至文件名列表传输完成。(1) When there is a subsequent frame in the current data frame, send a request for a subsequent frame to the target electric meter device; when receiving a data frame returned from the target electric meter device, use the returned data frame as the current data frame and return until the subsequent frame of the current data frame is determined based on the control code of the current frame data, until there is no subsequent frame in the current data frame, the reception of the file name list is completed; in the case of subsequent frames, the master device continues to perform frame-by-frame requests , until the file name list transfer is completed.
(2)在所述当前数据帧不存在后续帧时,完成文件名列表的接收,在不存在后续帧的情况下,说明文件名列表的数据量小于或者等于一帧,且已经传输完毕。(2) When there is no subsequent frame in the current data frame, the reception of the file name list is completed. If there is no subsequent frame, it means that the data amount of the file name list is less than or equal to one frame and the transmission has been completed.
(3)在接收到来自所述目标电表设备返回异常回复时,判定无对应目录,并结束文件请求。(3) When receiving an abnormal reply from the target electric meter device, it is determined that there is no corresponding directory and the file request is ended.
S220,在接收到来自所述目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧,其中,所述文件名列表基于所述请求目录文件帧生成,所述请求文件信息帧基于所述文件名列表生成;S220: When receiving the file name list returned from the target electric meter device, send a request file information frame to the target electric meter device, wherein the file name list is generated based on the request directory file frame, and the request file information frame Generated based on the list of file names;
在完成文件名列表的接收后,主设备再从文件名列表中选择其中一个文件,并基于选择的文件信息构建请求文件信息帧,进而请求从设备中的对应文件的信息。After completing the reception of the file name list, the master device selects one of the files from the file name list, constructs a request file information frame based on the selected file information, and then requests the corresponding file information from the slave device.
由于文件信息的数据量也可能大于一帧,因此,从设备可能返回一帧或者多帧文件信息。同样地,本申请采用逐帧请求的方式来请求文件信息,具体过程如下:Since the data amount of the file information may be larger than one frame, the slave device may return one or more frames of file information. Similarly, this application uses a frame-by-frame request method to request file information. The specific process is as follows:
基于当前帧数据的控制码确定所述当前数据帧的后续帧,其中,所述当前帧数据为所述目标电表设备返回的数据帧。The subsequent frame of the current data frame is determined based on the control code of the current frame data, where the current frame data is the data frame returned by the target electric meter device.
(1)在所述当前数据帧存在后续帧时,向目标电表设备发送请求后续帧;在接收到来自所述目标电表设备返回的数据帧时,将返回的数据帧作为当前数据帧,并返回至基于当前帧数据的控制码确定所述当前数据帧的后续帧,直至当前数据帧不存在后续帧时,完成文件信息的接收;(1) When there is a subsequent frame in the current data frame, send a request for a subsequent frame to the target electric meter device; when receiving a data frame returned from the target electric meter device, use the returned data frame as the current data frame and return Determine the subsequent frame of the current data frame based on the control code of the current frame data, and complete the reception of the file information until there is no subsequent frame in the current data frame;
(2)在所述当前数据帧不存在后续帧时,完成文件信息的接收。(2) When there is no subsequent frame in the current data frame, the reception of the file information is completed.
S230,在接收到来自所述目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧,其中,所述请求文件内容帧基于所述文件信息生成;S230. When receiving the file information returned from the target electric meter device, send a request file content frame to the target electric meter device, where the request file content frame is generated based on the file information;
文件内容同样采用逐帧请求的方式来请求,具体过程包括:The file content is also requested frame by frame. The specific process includes:
基于当前帧数据的控制码确定所述当前数据帧的后续帧,其中,所述当前帧数据为所述目标电表设备返回的数据帧。The subsequent frame of the current data frame is determined based on the control code of the current frame data, where the current frame data is the data frame returned by the target electric meter device.
(1)在所述当前数据帧存在后续帧时,向目标电表设备发送请求后续帧;在接收到来自所述目标电表设备返回的数据帧时,将返回的数据帧作为当前数据帧,并返回至基于当前帧数据的控制码确定所述当前数据帧的后续帧,直至当前数据帧不存在后续帧时,完成文件内容的接收;(1) When there is a subsequent frame in the current data frame, send a request for a subsequent frame to the target electric meter device; when receiving a data frame returned from the target electric meter device, use the returned data frame as the current data frame and return Determine the subsequent frame of the current data frame based on the control code of the current frame data, and complete the reception of the file content until there is no subsequent frame in the current data frame;
(2)在所述当前数据帧不存在后续帧时,完成文件内容的接收。(2) When there is no subsequent frame in the current data frame, the reception of the file content is completed.
S240,在接收到来自所述目标电表设备返回的文件内容时,完成文件请求,其中,所述文件内容基于所述请求文件内容帧生成。S240: When receiving the file content returned from the target electric meter device, complete the file request, where the file content is generated based on the request file content frame.
图3为本申请一实施例中的一种基于多功能电能表通信规约的文件发送方法的流程示意图,如图3所示,本申请还提供一种基于多功能电能表通信规约的文件发送方法,包括:Figure 3 is a schematic flow chart of a file sending method based on a multifunctional electric energy meter communication protocol in an embodiment of the present application. As shown in Figure 3, the present application also provides a file sending method based on a multifunctional electric energy meter communication protocol. ,include:
S310,在发送文件时,向目标电表设备发送文件信息帧;S310, when sending the file, send the file information frame to the target electric meter device;
S320,在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧,其中,所述第一信息确认帧基于所述文件信息帧生成;S320, upon receiving the first information confirmation frame returned from the target electric meter device, send a file content frame to the target electric meter device, wherein the first information confirmation frame is generated based on the file information frame;
S330,在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送,其中,所述第二信息确认帧基于所述文件内容帧生成。S330: Upon receiving the second information confirmation frame returned from the target electric meter device, complete the file sending, wherein the second information confirmation frame is generated based on the file content frame.
其中,在主设备发送文件时,先发送信息。获得从设备的确认后,再发送文件内容,从设备再次确认后,完成发送。其中,文件内容是否写入至从设备也是由主设备控制的,具体包括:Among them, when the main device sends a file, the information is sent first. After obtaining the confirmation from the slave device, the file content is sent. After the slave device confirms again, the sending is completed. Among them, whether the file content is written to the slave device is also controlled by the master device, including:
向目标电表设备发送写入确认帧,以使得所述目标电表设备写入文件;或者向目标电表设备发送撤销帧,以使得所述目标电表设备撤销文件。Send a write confirmation frame to the target electric meter device to cause the target electric meter device to write the file; or send a cancel frame to the target electric meter device to cause the target electric meter device to cancel the file.
在本申请一实施例中,还包括:In an embodiment of this application, it also includes:
向目标电表设备发送文件内容帧的同时,向目标电表设备发送结束帧,以终止文件传输。While sending the file content frame to the target electric meter device, send an end frame to the target electric meter device to terminate the file transfer.
本申请在文件传输过程中,也可以进行终止。This application can also be terminated during the file transfer process.
在本申请另一实施例中,通过如下几种情况来展示本申请中的基于多功能电能表通信规约的文件传输方法:In another embodiment of the present application, the file transmission method based on the multifunctional electric energy meter communication protocol in the present application is demonstrated through the following situations:
图4为本申请一实施例中的文件名列表请求方法的流程示意图,如图4所示,文件名列表请求存在三种情况,具体包括:Figure 4 is a schematic flow chart of a file name list request method in an embodiment of the present application. As shown in Figure 4, there are three situations for file name list requests, specifically including:
情况一:Situation one:
1)主方设备发送请求目录下文件帧(0x0E0E0E01),查询从方设备指定目录下的文件名列表;1) The master device sends a file frame (0x0E0E0E01) in the request directory and queries the file name list in the directory specified by the slave device;
2)从方设备回复请求目录下文件帧(0x0E0E0E01),回复主方设备指定目录下的文件名列表,无后续帧。2) The slave device replies with a file frame (0x0E0E0E01) in the requested directory and a list of file names in the directory specified by the master device, with no subsequent frames.
情况二:Situation two:
1)主方设备发送请求目录下文件帧(0x0E0E0E01),查询从方设备指定目录下的文件名列表;1) The master device sends a file frame (0x0E0E0E01) in the request directory and queries the file name list in the directory specified by the slave device;
2)从方设备回复请求目录下文件帧(0x0E0E0E01),回复主方设备指定目录下的文件名列表,有后续帧;2) The slave device replies with a file frame (0x0E0E0E01) in the requested directory, and replies with a list of file names in the directory specified by the master device, with subsequent frames;
3)主方设备发送请求后续帧(0x0E0E0E01);3) The master device sends a request for a subsequent frame (0x0E0E0E01);
4)从方设备回复请求后续帧(0x0E0E0E01);4) The slave device replies with a request for subsequent frames (0x0E0E0E01);
5)直到回复无后续帧。5) Until there is no subsequent frame reply.
情况三:Situation three:
主方设备发送请求帧(0x0E0E0E01),查询从方设备指定目录下的文件名列表;The master device sends a request frame (0x0E0E0E01) to query the file name list in the directory specified by the slave device;
从方设备异常回复,无改目录。The slave device responds abnormally without changing the directory.
图5为本申请一实施例中的请求文件内容流程示意图,如图5所示,主方设备向从方设备请求文件内容的过程包括:Figure 5 is a schematic flowchart of requesting file content in an embodiment of the present application. As shown in Figure 5, the process of the master device requesting file content from the slave device includes:
1)主方设备发送请求文件信息帧(0x0E0E0E02),查询从方设备指定文件信息;1) The master device sends a request file information frame (0x0E0E0E02) to query the specified file information of the slave device;
2)从方设备回复请求文件信息帧(0x0E0E0E02),回复主方设备指定文件信息;2) The slave device replies with the request file information frame (0x0E0E0E02) and replies with the specified file information of the master device;
3)主方设备发送请求文件内容帧(0x0E0E0E03),请求从方设备指定文件内容;3) The master device sends a request file content frame (0x0E0E0E03) to request the slave device to specify the file content;
4)从方设备回复请求文件内容帧(0x0E0E0E03),回复主方设备指定文件内容,有后续帧;4) The slave device replies with the requested file content frame (0x0E0E0E03), and replies with the specified file content of the master device, with subsequent frames;
5)直到回复无后续帧,主方设备接收完整文件内容。5) Until there is no subsequent frame in the reply, the master device receives the complete file content.
图6为本申请一实施例中的主站下发文件的流程示意图,如图6所示,主方设备向从方设备下发文件的过程包括:Figure 6 is a schematic flowchart of the master station delivering files in an embodiment of the present application. As shown in Figure 6, the process of the master device delivering files to the slave device includes:
1)主方设备发送文件信息帧(0x0E0E0E04),告知从方设备指定文件信息1) The master device sends a file information frame (0x0E0E0E04) to inform the slave device of the specified file information.
2)从方设备回复接收文件信息确认帧(0x0E0E0E04)2) The slave device replies with the received file information confirmation frame (0x0E0E0E04)
3)主方设备发送文件内容帧(0x0E0E0E05),下发文件内容给从方设备3) The master device sends the file content frame (0x0E0E0E05) and delivers the file content to the slave device.
4)从方设备回复接收文件内容确认帧(0x0E0E0E05)4) The slave device replies with the received file content confirmation frame (0x0E0E0E05)
5)主方设备将所有文件内容发送完成,从方设备接收完成5) The master device has completed sending all file contents and the slave device has completed receiving
6)主方设备发送文件下发确认帧(0x0E0E0E06),告知从方设备确认写或者撤销6) The master device sends a file delivery confirmation frame (0x0E0E0E06) to inform the slave device to confirm or cancel the writing.
7)主方设备发送文件过程中也可以发送结束帧(0x0E0E0E0F)。7) The master device can also send an end frame (0x0E0E0E0F) when sending files.
在本申请中,主站请求帧和从站返回帧的内容都与现有的DL-T 645-2007一致,具体介绍如下:In this application, the contents of the master station request frame and the slave station return frame are consistent with the existing DL-T 645-2007. The specific introduction is as follows:
主站请求帧Master request frame
功能:主站向从站下发文件传输命令。Function: The master station issues file transfer commands to the slave station.
包含控制码,例如:C=0EHContains control codes, for example: C=0EH
帧长度L=04H(标识码)+DATA的长度Frame length L = 04H (identification code) + length of DATA
帧格式:DIO DI1 DI2 DI3+DATAFrame format: DIO DI1 DI2 DI3+DATA
完整的主站请求帧如表1所示:The complete master request frame is shown in Table 1:
表1.主站请求帧内容示意表Table 1. Master station request frame content representation
在表1中,前两个68H之间的内容均为固定格式,0EH表示该帧的控制码,L表示帧长度,DATA为数据,包含标识码(即DIO、DI1、DI2和DI3)和数据本身,CS和16H位均为固定格式。In Table 1, the contents between the first two 68H are in a fixed format. 0EH represents the control code of the frame, L represents the frame length, and DATA is data, including identification codes (i.e., DIO, DI1, DI2 and DI3) and data By itself, both CS and 16H bits are fixed format.
本申请通过标识码DIO、DI1、DI2和DI3来区分不同的请求帧类型,具体类型如表2所示:This application uses identification codes DIO, DI1, DI2 and DI3 to distinguish different request frame types. The specific types are shown in Table 2:
表2.请求帧类型示意表Table 2. Request frame type representation
从站应答帧slave response frame
功能:从站回复帧Function: slave station reply frame
控制码:C=8EH无后续数据帧,C=AEH有后续数据帧Control code: C=8EH without subsequent data frame, C=AEH with subsequent data frame
帧长度L=DATA的长度Frame length L=length of DATA
完整的从站应答帧如表3所示:The complete slave response frame is shown in Table 3:
表3.从站应答帧内容示意表Table 3. Slave station response frame content representation
从站应答帧的内容定义与主站请求帧的内容定义一致,在此不再赘述。从站应答帧的具体类型如表4所示:The content definition of the slave station response frame is consistent with the content definition of the master station request frame, and will not be described again here. The specific types of slave response frames are shown in Table 4:
表4.应答帧类型示意表Table 4. Response frame type representation
本申请还包括从站异常应答帧This application also includes the slave station exception response frame
功能:异常应答,无该目录Function: Exception response, there is no such directory
控制码:C=CEHControl code: C=CEH
帧长度L=01HFrame length L=01H
完整的异常应答帧如表5所示:The complete exception response frame is shown in Table 5:
表5.异常应答帧内容示意表Table 5. Abnormal response frame content representation
本申请基于DL-T 645-2007_多功能电能表通信规约,通过增加了文件传输相关数据项解决了DL-T 645-2007_多功能电能表通信规约的设备之间无法传输文件的问题,通过获取设备中数据文件,可以大大提高设备检修的准确率,并且为问题分析提供原始文件的支撑。可以广泛运用于基于DL-T 645-2007_多功能电能表通信规约的终端设备。This application is based on DL-T 645-2007_Multifunctional Electric Energy Meter Communication Protocol. By adding data items related to file transmission, it solves the problem that files cannot be transmitted between devices in DL-T 645-2007_Multifunctional Electric Energy Meter Communication Protocol. By obtaining the data files in the equipment, the accuracy of equipment maintenance can be greatly improved, and original file support can be provided for problem analysis. It can be widely used in terminal equipment based on DL-T 645-2007_Multifunctional energy meter communication protocol.
本发明的一种基于多功能电能表通信规约的文件传输方法,在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;在接收到来自目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧;在接收到来自目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧;在接收到来自目标电表设备返回的文件内容时,完成文件请求。在发送文件时,向目标电表设备发送文件信息帧;在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧;在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送。本申请通过约定多功能电表之间的文件传输协议,实现多功能电表之间的文件传输。有利于设备检修及设备数据文件的获取保存。The present invention is a file transmission method based on the multifunctional electric energy meter communication protocol. When requesting a file, a request directory file frame is sent to the target electric meter device to query the file name list under the specified directory in the target electric meter device; after receiving the request from When the target electric meter device returns a file name list, send a request file information frame to the target electric meter device; when receiving the file information returned from the target electric meter device, send a request file content frame to the target electric meter device; when receiving a request file content frame from the target electric meter device The file contents are returned when the file request is completed. When sending a file, send a file information frame to the target electric meter device; when receiving the first information confirmation frame returned from the target electric meter device, send a file content frame to the target electric meter device; when receiving the first information confirmation frame from the target electric meter device; When the second information confirmation frame is returned, the file sending is completed. This application implements file transfer between multi-function meters by agreeing on a file transfer protocol between them. It is conducive to equipment maintenance and the acquisition and storage of equipment data files.
本申请还提供一种基于多功能电能表通信规约的文件传输装置,包括:This application also provides a file transmission device based on the multifunctional electric energy meter communication protocol, including:
第一请求模块,用于在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;The first request module is used to send a request directory file frame to the target electric meter device when requesting a file, so as to query the file name list in the specified directory in the target electric meter device;
第二请求模块,用于在接收到来自所述目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧,其中,所述文件名列表基于所述请求目录文件帧生成,所述请求文件信息帧基于所述文件名列表生成;The second request module is configured to send a request file information frame to the target electric meter device when receiving a file name list returned from the target electric meter device, wherein the file name list is generated based on the request directory file frame, so The request file information frame is generated based on the file name list;
第三请求模块,用于在接收到来自所述目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧,其中,所述请求文件内容帧基于所述文件信息生成;A third request module, configured to send a request file content frame to the target electric meter device when receiving file information returned from the target electric meter device, wherein the request file content frame is generated based on the file information;
第四请求模块,用于在接收到来自所述目标电表设备返回的文件内容时,完成文件请求,其中,所述文件内容基于所述请求文件内容帧生成。The fourth request module is configured to complete the file request when receiving the file content returned from the target electric meter device, wherein the file content is generated based on the request file content frame.
本申请还提供另一种基于多功能电能表通信规约的文件传输装置,包括:This application also provides another file transmission device based on the multifunctional electric energy meter communication protocol, including:
第一发送模块,用于在发送文件时,向目标电表设备发送文件信息帧;The first sending module is used to send file information frames to the target electric meter device when sending files;
第二发送模块,用于在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧,其中,所述第一信息确认帧基于所述文件信息帧生成;The second sending module is configured to send a file content frame to the target electric meter device when receiving the first information confirmation frame returned from the target electric meter device, wherein the first information confirmation frame is generated based on the file information frame. ;
第三发送模块,用于在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送,其中,所述第二信息确认帧基于所述文件内容帧生成。The third sending module is configured to complete file sending when receiving a second information confirmation frame returned from the target electric meter device, wherein the second information confirmation frame is generated based on the file content frame.
本发明的一种基于多功能电能表通信规约的文件传输装置,在请求文件时,向目标电表设备发送请求目录文件帧,以查询目标电表设备内指定目录下的文件名列表;在接收到来自目标电表设备返回的文件名列表时,向目标电表设备发送请求文件信息帧;在接收到来自目标电表设备返回的文件信息时,向目标电表设备发送请求文件内容帧;在接收到来自目标电表设备返回的文件内容时,完成文件请求。在发送文件时,向目标电表设备发送文件信息帧;在接收到来自所述目标电表设备返回的第一信息确认帧时,向目标电表设备发送文件内容帧;在接收到来自所述目标电表设备返回的第二信息确认帧时,完成文件发送。本申请通过约定多功能电表之间的文件传输协议,实现多功能电表之间的文件传输。有利于设备检修及设备数据文件的获取保存。The present invention is a file transmission device based on the multifunctional electric energy meter communication protocol. When requesting a file, it sends a request directory file frame to the target electric meter device to query the file name list in the specified directory in the target electric meter device; upon receiving the request from When the target electric meter device returns a file name list, send a request file information frame to the target electric meter device; when receiving the file information returned from the target electric meter device, send a request file content frame to the target electric meter device; when receiving a request file content frame from the target electric meter device The file contents are returned when the file request is completed. When sending a file, send a file information frame to the target electric meter device; when receiving the first information confirmation frame returned from the target electric meter device, send a file content frame to the target electric meter device; when receiving the first information confirmation frame from the target electric meter device; When the second information confirmation frame is returned, the file sending is completed. This application implements file transfer between multi-function meters by agreeing on a file transfer protocol between them. It is conducive to equipment maintenance and the acquisition and storage of equipment data files.
在上述实施例中,尽管已经结合了本发明的具体实施例对本发明进行了描述,但是根据前面的描述,这些实施例的很多替换、修改和变形对本领域普通技术人员来说将是显而易见的。本发明的实施例旨在涵盖落入所附权利要求的宽泛范围之内的所有这样的替换、修改和变型。In the above embodiments, although the invention has been described in conjunction with specific embodiments of the invention, many substitutions, modifications and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. The embodiments of the invention are intended to embrace all such alternatives, modifications and variations that fall within the broad scope of the appended claims.
上述实施例仅例示性说明本发明的原理及其功效,而非用于限制本发明。任何熟悉此技术的人士皆可在不违背本发明的精神及范畴下,对上述实施例进行修饰或改变。因此,举凡所属技术领域中具有通常知识者在未脱离本发明所揭示的精神与技术思想下所完成的一切等效修饰或改变,仍应由本发明的权利要求所涵盖。The above embodiments only illustrate the principles and effects of the present invention, but are not intended to limit the present invention. Anyone familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of the invention. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed in the present invention shall still be covered by the claims of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311135698.3ACN117221310A (en) | 2023-09-05 | 2023-09-05 | File transmission method and device based on multifunctional electric energy meter communication protocol |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311135698.3ACN117221310A (en) | 2023-09-05 | 2023-09-05 | File transmission method and device based on multifunctional electric energy meter communication protocol |
| Publication Number | Publication Date |
|---|---|
| CN117221310Atrue CN117221310A (en) | 2023-12-12 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311135698.3APendingCN117221310A (en) | 2023-09-05 | 2023-09-05 | File transmission method and device based on multifunctional electric energy meter communication protocol |
| Country | Link |
|---|---|
| CN (1) | CN117221310A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119814773A (en)* | 2025-03-12 | 2025-04-11 | 深圳市德兰明海新能源股份有限公司 | Universal data transmission method, device and storage medium for Internet of Things |
| CN119814774A (en)* | 2025-03-12 | 2025-04-11 | 深圳市德兰明海新能源股份有限公司 | File transmission method, equipment and storage medium based on CAN protocol |
| CN119835266A (en)* | 2025-03-12 | 2025-04-15 | 深圳市德兰明海新能源股份有限公司 | File transmission method, device and storage medium based on Modbus protocol |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101409727A (en)* | 2008-11-24 | 2009-04-15 | 株洲南车时代电气股份有限公司 | Document transmission method and apparatus |
| CN109714130A (en)* | 2018-11-28 | 2019-05-03 | 南通先进通信技术研究院有限公司 | A kind of document transmission method based on fountain codes |
| CN112289017A (en)* | 2020-10-28 | 2021-01-29 | 国网安徽省电力有限公司合肥供电公司 | A kind of remote meter reading method and system of smart electric energy meter |
| CN114554313A (en)* | 2022-02-15 | 2022-05-27 | 江苏智臻能源科技有限公司 | Electric energy meter reading method based on DLT645-2007 protocol |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101409727A (en)* | 2008-11-24 | 2009-04-15 | 株洲南车时代电气股份有限公司 | Document transmission method and apparatus |
| CN109714130A (en)* | 2018-11-28 | 2019-05-03 | 南通先进通信技术研究院有限公司 | A kind of document transmission method based on fountain codes |
| CN112289017A (en)* | 2020-10-28 | 2021-01-29 | 国网安徽省电力有限公司合肥供电公司 | A kind of remote meter reading method and system of smart electric energy meter |
| CN114554313A (en)* | 2022-02-15 | 2022-05-27 | 江苏智臻能源科技有限公司 | Electric energy meter reading method based on DLT645-2007 protocol |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119814773A (en)* | 2025-03-12 | 2025-04-11 | 深圳市德兰明海新能源股份有限公司 | Universal data transmission method, device and storage medium for Internet of Things |
| CN119814774A (en)* | 2025-03-12 | 2025-04-11 | 深圳市德兰明海新能源股份有限公司 | File transmission method, equipment and storage medium based on CAN protocol |
| CN119835266A (en)* | 2025-03-12 | 2025-04-15 | 深圳市德兰明海新能源股份有限公司 | File transmission method, device and storage medium based on Modbus protocol |
| Publication | Publication Date | Title |
|---|---|---|
| CN117221310A (en) | File transmission method and device based on multifunctional electric energy meter communication protocol | |
| CN111540190B (en) | Data distribution method and device based on double-core intelligent electric meter and computer equipment | |
| CN110635982B (en) | Double-host communication method and system on communication bus, industrial control gateway and storage medium | |
| CN110704265A (en) | Early warning information active reporting method and system based on Modbus protocol | |
| CN111224837B (en) | Method and system for automatically identifying CAN communication baud rate of vehicle ECU | |
| WO2022089035A1 (en) | Communication method and related device | |
| CN105722040A (en) | Service message transmission method, apparatus and system | |
| CN112363479B (en) | A digital communication transmission method and system between field devices | |
| CN112995973B (en) | Network function network element searching method, network element and storage medium | |
| CN110554963B (en) | Application rollback method, device and storage medium | |
| CN108322482A (en) | A kind of method and device of protocol conversion | |
| CA2387211A1 (en) | Communication system, and connection setting method and connection setting program of exchange and terminal | |
| US8554966B2 (en) | Method for data exchange | |
| CN112241277A (en) | IC firmware update method | |
| CN104935530B (en) | A kind of method, interchanger and the system of intercomputer data exchange | |
| CN116170522A (en) | Data transmission method and device, electronic equipment and storage medium | |
| CN101056157B (en) | A transmission control device and its control method | |
| CN112241279B (en) | An adaptive electronic control unit software upgrade method, system and automobile | |
| CN114007200A (en) | A method, device, device and storage medium for sending scheduling command information | |
| CN112929184A (en) | Gateway equipment for connecting Internet of things sensing equipment and electric power information acquisition equipment | |
| CN115208794B (en) | Timer adjustment method, device, equipment and medium of Profibus-DP protocol | |
| CN118260221B (en) | Communication method, device, equipment and storage medium based on CAN bus | |
| CN117459347A (en) | Data transmission method and device, electronic equipment and storage medium | |
| US20240211421A1 (en) | Adapter and data transmission method under limited memory | |
| CN116756078B (en) | Notification method and device of pcie data packet and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |