Electric energy meter data transmission method and device of message queue telemetry transmission protocol

文档序号:196408 发布日期:2021-11-02 浏览:30次 中文

阅读说明:本技术 消息队列遥测传输协议的电能表数据传输方法和装置 (Electric energy meter data transmission method and device of message queue telemetry transmission protocol ) 是由 闵仕君 何珂 李智欢 刘恺 翟福谊 李路遥 陈世杰 于 2021-08-06 设计创作,主要内容包括:本发明提供了一种消息队列遥测传输协议的电能表数据传输方法和装置,涉及电能表数据采集的技术领域,包括,获取采集参数,并根据采集参数对采集脚本进行设置,其中,采集参数包括采集对象、采集周期、上传周期和上传渠道;基于消息队列遥测传输协议配置采集信息网络;根据采集脚本对电能表中已设置的数据对象进行采集;对从电能表接收的采集数据进行预处理;将预处理后的待发数据发送至上位机,解决了什么技术问题,解决数据交互困难的问题。(The invention provides an electric energy meter data transmission method and device of a message queue telemetry transmission protocol, which relate to the technical field of electric energy meter data acquisition and comprise the steps of acquiring acquisition parameters and setting an acquisition script according to the acquisition parameters, wherein the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel; configuring an information acquisition network based on a message queue telemetry transmission protocol; acquiring a set data object in the electric energy meter according to the acquisition script; preprocessing collected data received from the electric energy meter; and sending the preprocessed to-be-sent data to an upper computer, so that the technical problem is solved, and the problem of difficult data interaction is solved.)

1. A method for transmitting electric energy meter data of a message queue telemetry transmission protocol is applied to a collector, and comprises the following steps:

acquiring acquisition parameters, and setting an acquisition script according to the acquisition parameters, wherein the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel;

configuring an information acquisition network based on a message queue telemetry transmission protocol;

acquiring a set data object in the electric energy meter according to the acquisition script;

preprocessing collected data received from the electric energy meter;

and sending the preprocessed data to be sent to an upper computer.

2. The method of claim 1, wherein the step of pre-processing the collected data received from the power meter comprises:

receiving service data sent by the electric energy meter;

carrying out binary analysis on the service data to obtain analysis data;

and adjusting the analysis data into data to be sent according to the parameter type of the analysis data, wherein the data to be sent is in a JSON format.

3. The method of claim 2, wherein the step of adjusting the parsed data into the data to be transmitted according to the parameter type of the parsed data comprises:

sorting the analyzed data according to bytes, and dividing each parameter interval data, wherein the parameter interval data is used for representing electricity utilization service parameters;

and adjusting each parameter interval data into data to be transmitted.

4. The method according to claim 1, wherein the step of sending the pre-processed data to be sent to the upper computer comprises:

and sending the data to be sent to an upper computer through a wireless network according to the uploading period.

5. The method of claim 1, wherein the step of configuring the gathering information network based on a message queue telemetry transport protocol comprises:

the method is based on a message queue telemetry transmission protocol and is set as an acquisition end and a receiving end of an information acquisition network.

6. The method of claim 1, further comprising:

and acquiring and updating the acquisition script from the data transmission server through the data transmission unit.

7. The method of claim 1, further comprising:

and setting a message queue to telemeter a database subscribed by the transmission server to receive the message.

8. An electric energy meter data transmission device of a message queue telemetry transmission protocol is applied to a collector, and the device comprises:

the device comprises a setting module, a processing module and a processing module, wherein the setting module is used for acquiring acquisition parameters and setting an acquisition script according to the acquisition parameters, and the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel;

the configuration module is used for configuring an information acquisition network based on a message queue telemetry transmission protocol;

the acquisition module acquires the set data object in the electric energy meter according to the acquisition script;

the preprocessing module is used for preprocessing the acquired data received from the electric energy meter;

and the transmission module is used for transmitting the preprocessed data to be transmitted to the upper computer.

9. An electronic device comprising a memory, a processor, and a program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium, characterized in that a computer program is stored in the readable storage medium, which computer program, when executed, implements the method of any of claims 1-7.

Technical Field

The invention relates to the technical field of electric energy meter data acquisition, in particular to an electric energy meter data transmission method and device of a message queue telemetry transmission protocol.

Background

Electric energy is one of the energy sources which can not be left in daily life and industrial production. In order to better utilize electric energy, an intelligent automatic acquisition transmission scheme is gradually popularized at present. In order to better monitor electric energy data and improve the electric energy supply quality in parks such as factories and office buildings, better collection and transmission schemes are also needed.

In the current electric energy meter data acquisition and transmission scheme, the acquisition script of the acquisition device is difficult to update, and the problems of difficult data interaction with the electric energy meter and the master station, high link leakage risk and the like exist.

Disclosure of Invention

The invention aims to provide a method and a device for transmitting electric energy meter data of a message queue telemetry transmission protocol, which are used for acquiring data from an electric energy meter through the message queue telemetry transmission protocol so as to relieve the technical problem of difficult data interaction.

In a first aspect, an embodiment of the present invention provides an electric energy meter data transmission method of a message queue telemetry transmission protocol, which is applied to a collector, and the method includes:

acquiring acquisition parameters, and setting an acquisition script according to the acquisition parameters, wherein the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel;

configuring an information acquisition network based on a message queue telemetry transmission protocol;

acquiring a set data object in the electric energy meter according to the acquisition script;

preprocessing collected data received from the electric energy meter;

and sending the preprocessed data to be sent to an upper computer.

With reference to the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, where the step of preprocessing the collected data received from the electric energy meter includes:

receiving service data sent by the electric energy meter;

carrying out binary analysis on the service data to obtain analysis data;

and adjusting the analysis data into data to be sent according to the parameter type of the analysis data, wherein the data to be sent is in a JSON format.

With reference to the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect, where the step of adjusting the parsed data into data to be sent according to a parameter type of the parsed data includes:

sorting the analyzed data according to bytes, and dividing each parameter interval data, wherein the parameter interval data is used for representing electricity utilization service parameters;

and adjusting each parameter interval data into data to be transmitted.

With reference to the first aspect, an embodiment of the present invention provides a third possible implementation manner of the first aspect, where the step of sending the preprocessed data to be sent to the upper computer includes:

and sending the data to be sent to an upper computer through a wireless network according to the uploading period.

With reference to the first aspect, an embodiment of the present invention provides a fourth possible implementation manner of the first aspect, where the step of configuring an information acquisition network based on a message queue telemetry transmission protocol includes:

the method is based on a message queue telemetry transmission protocol and is set as an acquisition end and a receiving end of an information acquisition network.

With reference to the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect, where the method further includes:

and acquiring and updating the acquisition script from the data transmission server through the data transmission unit.

With reference to the first aspect, an embodiment of the present invention provides a sixth possible implementation manner of the first aspect, where the method further includes:

and setting a message queue to telemeter a database subscribed by the transmission server to receive the message.

In a second aspect, an embodiment of the present invention further provides an apparatus for transmitting power meter data in a message queue telemetry transmission protocol, where the apparatus includes:

the device comprises a setting module, a processing module and a processing module, wherein the setting module is used for acquiring acquisition parameters and setting an acquisition script according to the acquisition parameters, and the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel;

the configuration module is used for configuring an information acquisition network based on a message queue telemetry transmission protocol;

the acquisition module acquires the set data object in the electric energy meter according to the acquisition script;

the preprocessing module is used for preprocessing the acquired data received from the electric energy meter;

and the transmission module is used for transmitting the preprocessed data to be transmitted to the upper computer.

In a third aspect, an embodiment provides an electronic device, including a memory and a processor, where the memory stores a computer program operable on the processor, and the processor implements the steps of the method described in any one of the foregoing embodiments when executing the computer program.

In a fourth aspect, embodiments provide a machine-readable storage medium having stored thereon machine-executable instructions that, when invoked and executed by a processor, cause the processor to carry out the steps of the method of any preceding embodiment.

The embodiment of the invention provides an electric energy meter data transmission method and device based on a message queue telemetry transmission protocol.

Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.

In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.

Fig. 1 is a flowchart of a power meter data transmission method of a message queue telemetry transmission protocol according to an embodiment of the present invention;

fig. 2 is a schematic view of an application scenario of electric energy meter data transmission of a message queue telemetry transmission protocol according to an embodiment of the present invention;

fig. 3 is a functional block diagram of an electric energy meter data transmission apparatus of a message queue telemetry transmission protocol according to an embodiment of the present invention;

fig. 4 is a schematic diagram of a hardware architecture of an electronic device according to an embodiment of the present invention.

Detailed Description

To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The current electric meter information acquisition network mainly comprises three nodes, namely a multifunctional electric energy meter, an acquisition device and a master station. The line that collector and electric energy meter are linked mainly relies on the RS485 line, and collector and main website link and generally rely on wireless or ethernet mode to go on. The electric energy meter generally adopts equipment such as singlechip STM32 as the controller, and the collector has control module such as STM32, PLC usually, and has communication module. And the host computer of the main station is a man-machine interaction end and is used as an initial section for issuing instructions.

The inventor researches and discovers that the current electric energy meter data acquisition and transmission method mainly has the following problems:

1. the acquisition is carried out by adopting a PLC control module, and the space occupied by the acquisition device is too large.

2. Because the electric energy meter relates to multiple equipment manufacturers and multiple protocols, the data interaction between the collector and the electric energy meter is inconvenient.

3. Due to the fact that customization development of the analysis program is complex, updating of the acquisition script of the acquisition device is difficult.

4. Because the collector and the master station mostly communicate in two ways, the risk of the communication link is increased.

Based on the above, the electric energy meter data transmission method and device of the message queue telemetry transmission protocol provided by the embodiment of the invention collect data from the electric energy meter through the message queue telemetry transmission protocol, so as to alleviate the technical problem of difficult data interaction.

In order to facilitate understanding of the embodiment, a detailed description is first given to the electric energy meter data transmission method of the message queue telemetry transmission protocol disclosed by the embodiment of the invention, and the method is stable in communication, convenient to interact, universal and capable of being applied to scenes such as common businesses, factory parks and the like.

Fig. 1 is a flowchart of a method for transmitting data of an electric energy meter according to a message queue telemetry transmission protocol, where the method is applied to a collector.

Referring to fig. 1, the method includes:

and S102, acquiring acquisition parameters and setting an acquisition script according to the acquisition parameters, wherein the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel.

It should be noted that there are two ways for deploying the acquisition script: the upper computer compiles a script and then physically burns the script to the collector; or the upper computer compiles the script, issues the script in a remote mode and deploys the script into the collector. The upper computer, i.e. the master station or the remote control terminal, is generally a computer with a visual interface, which is convenient for interaction with an operator. The upper computer of the embodiment of the invention can be loaded with a Windows system and is communicated with the Internet. And issuing a set and compiled acquisition script program through the computer. If the script program is written by a high-level program language such as C language, the upper computer compiles the collection script into a collector executable language.

It can be understood that, after the acquisition parameters are read by the collector, the corresponding code functions of the acquisition script can be automatically set or modified, or the acquisition script can be manually modified by the acquisition parameters.

And step S104, configuring an information acquisition network based on the message queue telemetry transmission protocol.

And S106, acquiring the set data object in the electric energy meter according to the acquisition script.

The collector sends out a collection signal according to the script program, collects a set data object in the electric energy meter according to the collection signal, and the collector carries out communication access through an MODBUS communication protocol and receives the electric energy meter data object transmitted in an RS485 communication mode.

And step S108, preprocessing the collected data received from the electric energy meter.

And step S110, sending the preprocessed data to be sent to an upper computer.

The inventor researches and discovers that the quality of the electric energy supplied in the later stage of the electric energy meter data acquisition and transmission schedule is influenced by the acquisition period, the reporting channel, the storage mode, the use and other factors of the electric energy meter data acquisition and transmission system. Therefore, the embodiment of the invention provides an electric energy meter acquisition and transmission scheme with the characteristics of stability, high efficiency, easy interaction, safety, convenience and the like, and data is acquired from the electric energy meter through a message queue telemetering transmission protocol so as to solve the problems.

In some embodiments, step S104 further comprises the steps of:

step 1.1), setting the acquisition end and the receiving end of the information acquisition network based on the message queue telemetry transmission protocol.

The information acquisition network sets an acquisition end Publish end, a receiving end Subscribe end of a database for receiving acquired information, a target Topic and the like based on a message queue telemetry transmission MQTT protocol.

In some embodiments, step S108, comprises the steps of:

step 2.1), receiving service data sent by the electric energy meter;

step 2.2), carrying out binary analysis on the service data to obtain analysis data;

the service data is generally in a hexadecimal format, and the hexadecimal service data is decoded, in the embodiment of the invention, the hexadecimal service data is converted into binary analysis data.

And 2.3) adjusting the analyzed data into data to be sent according to the parameter type of the analyzed data, wherein the data to be sent is in a JSON format.

In some embodiments, step 2.3) further comprises the following steps, in particular:

and 2.3.1) sequencing the analyzed data according to bytes, and dividing each parameter interval data, wherein the parameter interval data is used for representing the electricity utilization service parameters.

And 2.3.2) adjusting the data of each parameter interval into data to be sent.

Illustratively, the analyzed data is divided into parameter intervals according to byte ordering and the like, and the parameter intervals comprise a plurality of parameters such as an A-phase voltage, a B-phase voltage, a C-phase voltage and an average phase voltage. In this step, the data in the byte code format is usually converted into the JSON format for distribution and transmission. And the subscriber is easy to read and write after receiving the data.

In some embodiments, step S110 may also be implemented by the following steps, specifically including:

and 3.1) sending the data to be sent to the upper computer through a wireless network according to the uploading period.

In some embodiments, the method further comprises:

and 4.1) acquiring the acquisition script from the data transmission server through the data transmission unit and updating.

The collector is connected with each electric energy meter in an RS485 master-slave connection mode by adopting a data transmission unit DTU. The DTU can effectively reduce the volume of the collector, and is convenient and fast to install. And the DTU performs script configuration and updating through the DTU server. The DTU server is connected with the main station through a network and receives script information and the like.

In some embodiments, the above method may also be implemented by steps comprising:

and 5.1) setting a message queue to telemeter the database subscribed by the transmission server to receive messages so as to receive the target subscription information sent by the database.

In the actual application process, as shown in fig. 2, the remote control end configures the acquisition script as an upper computer, sends the configured acquisition script to the data transmission DTU server through the network, the data transmission DTU server sends the configured acquisition script to the data transmission module DTU of the collector, the collector sets based on the parameters in the acquisition script, configures the network, and acquires a large number of data objects acquired by the electric energy meter according to the acquisition script. The electric energy meter can send the data object to a data transmission module DTU of the collector through an RS485 protocol. The collector analyzes and preprocesses the data object, generates data to be sent and sends the data to the remote control end through a release or wireless network such as a 4G network. In some embodiments, the collector is further configured to send subscription information to the database server according to the message queue telemetry transport protocol server, perform setting so as to receive target subscription information sent by the database server, and the remote control terminal calls the target subscription information from the collector.

The electric energy meter data acquisition and transmission scheme based on the MQTT protocol has the following benefits:

1. the acquisition unit adopts a DTU data transmission module, and has small volume, simple deployment and easy disassembly;

2. converting the collected service data into a JSON format for convenient transmission and use in each network;

3. the updating script can be deployed remotely through the DTU server;

4. the MQTT issuing and subscribing mechanism enhances the directional transmission capability of data transmission;

5. the issue of the acquisition instruction is placed on the near-table side, so that the possibility of hijacking of a data channel is reduced.

As shown in fig. 3, an embodiment of the present invention further provides an apparatus for transmitting power meter data in a message queue telemetry transmission protocol, where the apparatus includes:

the device comprises a setting module, a processing module and a processing module, wherein the setting module is used for acquiring acquisition parameters and setting an acquisition script according to the acquisition parameters, and the acquisition parameters comprise an acquisition object, an acquisition period, an uploading period and an uploading channel;

the configuration module is used for configuring an information acquisition network based on a message queue telemetry transmission protocol;

the acquisition module acquires the set data object in the electric energy meter according to the acquisition script;

the preprocessing module is used for preprocessing the acquired data received from the electric energy meter;

and the transmission module is used for transmitting the preprocessed data to be transmitted to the upper computer.

The electric energy meter data transmission device of the message queue telemetry transmission protocol provided by the embodiment of the invention has the same technical characteristics as the electric energy meter data transmission method of the message queue telemetry transmission protocol provided by the embodiment, so that the same technical problems can be solved, and the same technical effect can be achieved.

In this embodiment, the electronic device may be, but is not limited to, a Computer device with analysis and processing capabilities, such as a Personal Computer (PC), a notebook Computer, a monitoring device, and a server.

As an exemplary embodiment, referring to fig. 4, the electronic device 110 includes a communication interface 111, a processor 112, a memory 113, and a bus 114, wherein the processor 112, the communication interface 111, and the memory 113 are connected by the bus 114; the memory 113 is used for storing a computer program for supporting the processor 112 to execute the image sharpening method, and the processor 112 is configured to execute the program stored in the memory 113.

A machine-readable storage medium as referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: a RAM (random Access Memory), a volatile Memory, a non-volatile Memory, a flash Memory, a storage drive (e.g., a hard drive), any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.

The non-volatile medium may be non-volatile memory, flash memory, a storage drive (e.g., a hard drive), any type of storage disk (e.g., an optical disk, dvd, etc.), or similar non-volatile storage medium, or a combination thereof.

It can be understood that, for the specific operation method of each functional module in this embodiment, reference may be made to the detailed description of the corresponding step in the foregoing method embodiment, and no repeated description is provided herein.

The computer-readable storage medium provided in the embodiments of the present invention stores a computer program, and when executed, the computer program code may implement the method described in any of the above embodiments, and for specific implementation, reference may be made to the method embodiment, which is not described herein again.

It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.

In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.

Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于标识注册解析的智能足底压力检测系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!