Electric energy meter and circuit breaker automatic pairing method based on power line carrier

文档序号:1957160 发布日期:2021-12-10 浏览:17次 中文

阅读说明:本技术 一种基于电力线载波的电能表与断路器自动配对方法 (Electric energy meter and circuit breaker automatic pairing method based on power line carrier ) 是由 章恩友 陈杨 黄科杰 蒋卫平 盛旭朝 郭巨锋 贺东 于 2021-09-08 设计创作,主要内容包括:本发明涉及一种基于电力线载波的电能表与断路器自动配对方法,依靠电力线载波通信发送配对指令并实现校验,可以不需要额外人力与扫描设备实现电能表与断路器的蓝牙自动配对,不仅可靠而且省时省力。(The invention relates to an electric energy meter and circuit breaker automatic pairing method based on power line carrier, which is characterized in that pairing instructions are sent and verification is realized by means of power line carrier communication, the Bluetooth automatic pairing of the electric energy meter and the circuit breaker can be realized without extra manpower and scanning equipment, and the method is reliable, time-saving and labor-saving.)

1. A method for automatically pairing an electric energy meter and a circuit breaker based on a power line carrier is characterized by comprising the following steps: the method comprises the following steps: before electrifying, all electric energy meters in the same ammeter box are unified with the Bluetooth communication UUID of the circuit breaker, the electric energy meter Bluetooth is configured to a host mode, the circuit breaker Bluetooth is configured to a slave mode, the connection is set to be free of a secret key, the electric energy meter and the circuit breaker automatically enter a transparent transmission mode after pairing, the electric energy meter and the circuit breaker check the state of the electric energy meter and the circuit breaker after electrifying and starting, if the electric energy meter and the circuit breaker are paired and completed, the electric energy meter and the circuit breaker are directly interconnected through a Bluetooth channel, if the electric energy meter and the circuit breaker are not paired or not paired and completed, the pairing process is started, and the pairing process comprises the following steps:

(1) the electric energy meter firstly controls the Bluetooth of the electric energy meter to receive the MAC addresses of all connectable devices with the same UUID nearby through the MCU of the electric energy meter;

(2) the circuit breaker MCU reads the MAC address of the circuit breaker Bluetooth and performs delay processing according to the MAC address of each circuit breaker;

(3) after the time delay processing, the breaker sends the MAC address through a power line carrier communication channel;

(4) the electric energy meter receives MAC addresses and detects load current, pairing validity is prejudged, if the prejudgment is valid, all the received MAC addresses of the connectable circuit breakers are compared with the received MAC addresses, sorting is carried out according to matching degree and is used as a secondary sequence table for verification, if connectable objects with differences larger than a certain threshold value are directly abandoned and are not verified, a target with the highest matching degree in unverified objects is selected at each time, the electric energy meter MCU controls the Bluetooth of the electric energy meter to carry out directional connection with the MAC addresses as objects, and because a master-slave mode is preset, the connection does not need permission of the Bluetooth of slave machines and passwords, and the electric energy meter enters a transparent transmission mode after the connection is finished;

(5) the electric energy meter entering a transparent transmission mode with the circuit breaker sends a control instruction through a Bluetooth channel and sends a verification request to the Bluetooth of the circuit breaker, wherein the verification request comprises a randomly generated verification code;

(6) after the circuit breaker receives the check request, the circuit breaker MCU sends a check code through a power line carrier communication channel;

(7) the electric energy meter compares the received check code with the check code generated before, if the check code is consistent with the check code generated before, the check is considered to be successful, the electric energy meter sends a pairing success instruction to the circuit breaker through the Bluetooth channel, if the check is failed, the MCU controls to disconnect the Bluetooth connection, and performs Bluetooth connection and check on the next target circuit breaker according to the matching degree sequence until the pairing is finally completed or all checks of the check order list are unsuccessful;

(8) after one round of pairing process time T, the electric energy meters and the circuit breakers which are not successfully paired enter the next round of pairing, namely the step (1) is repeated until all pairing is successful.

2. The method for automatically pairing the electric energy meter and the circuit breaker based on the power line carrier as claimed in claim 1, wherein: the pairing validity is judged in advance to judge whether a load current exceeding the starting current exists in the MAC receiving period, if not, the received MAC is not sent by the connected breaker, the MAC receiving is judged to be invalid, otherwise, the MAC receiving is judged to be valid by assuming that the MAC is sent by the connected breaker.

3. The method for automatically pairing the electric energy meter and the circuit breaker based on the power line carrier as claimed in claim 1, wherein: in the first round of pairing, the delay processing mode in the step (2) is that according to the last 6 bits of mantissa X of the MAC address of the circuit breaker, the delay processing of interval time X X T is carried out according to the value range of 0-63, T is the minimum time precision of the electric energy meter for identifying current, in the step (4), if the MAC address is the same with the lower 6 bits, simultaneous transmission can occur, because of the same frequency interference of carrier communication, if the electric energy meter cannot normally receive the MAC address, after the first round of pairing time T, the electric energy meter which is not successfully paired enters the second round of pairing.

4. The method for automatically pairing the electric energy meter and the circuit breaker based on the power line carrier as claimed in claim 3, wherein: during the second round of pairing, the circuit breaker in the step (2) firstly calculates CRC8 on the MAC address, the calculation result takes the lower 6 bits Y, the time delay processing of the interval time Y x t is carried out again, after the time delay processing, the circuit breaker returns to the step (3), and the electric energy meter returns to the step (4); and after the second round of pairing time T, the electric energy meters which are not successfully paired enter a third round of pairing.

5. The method for automatically pairing the electric energy meter and the circuit breaker based on the power line carrier as claimed in claim 4, wherein the method comprises the following steps: and in the third pairing, delaying and pairing are carried out by generating a random number R (0-3) with a smaller value, and pairing is carried out after continuously repeating delay processing until pairing is finished, wherein the repetition period is T1 and is smaller than T, so that accelerated pairing is realized.

Technical Field

The invention relates to a Bluetooth automatic pairing method for an electric energy meter and a circuit breaker.

Background

Along with popularization and application of the intelligent electric meter, the external circuit breaker with the Bluetooth communication function is popularized by national power grid plans, and the electric energy meter and the circuit breaker are required to perform data interaction through a Bluetooth protocol. However, in practical applications, a plurality of smart meters are often collocated with a plurality of bluetooth breakers in one meter box. Therefore, if the a meter is paired to the B breaker, it will cause the load measured by meter a to belong to the a breaker, but the control command sent to the B breaker, which causes serious problems in use. The scheme that the MAC address is scanned and obtained through the handheld device so as to set the electric meter for pairing currently needs a large amount of scanning devices, and also needs manpower and technical requirements, so that the limitation is large.

Therefore, the characteristic that the electric energy meter is directly connected with the circuit breaker is considered, communication can be conducted through live wires and currents, and the pairing process is automatically completed under the condition that extra manpower and scanning equipment are not needed. However, a current signal controlled by a motor in a general circuit breaker has a problem that a timing is unstable and a waveform error is large, and thus a limitation is large. In contrast, in an application situation where the communication distance is short and the transmission information is less, the communication method of the power line carrier communication chip is more reliable.

Disclosure of Invention

In order to overcome the defects in the prior art, the invention provides the automatic pairing method for the electric energy meter and the circuit breaker, which is realized by a reliable power line carrier communication method without additional manpower and scanning equipment.

The invention is realized by the following technical scheme:

a method for automatically pairing an electric energy meter and a circuit breaker based on a power line carrier is characterized by comprising the following steps: the method comprises the following steps: before power-on, all electric energy meters in the same electric meter box are unified with Bluetooth communication UUIDs of the circuit breakers, the Bluetooth of the electric energy meter is configured to be in a master mode, the Bluetooth of the circuit breaker is configured to be in a slave mode, the circuit breaker is set to be connected without a secret key, and the electric energy meters automatically enter a transparent transmission mode after being paired,

after the electrification is started, the electric energy meter and the circuit breaker both check the self state, if the pairing is completed, the Bluetooth channel interconnection of the electric energy meter and the circuit breaker is directly realized, if the pairing is not performed or is not completed, the pairing process is started, and the pairing process comprises the following steps:

(1) the electric energy meter firstly controls the electric energy meter Bluetooth to receive MAC addresses of all nearby connectable relays through the electric energy meter MCU, and because communication UUIDs of all master and slave Bluetooth are uniformly changed in advance, the master Bluetooth can only scan slave Bluetooth which is not successfully paired with the same communication UUID;

(2) the circuit breaker MCU reads the MAC address of the circuit breaker Bluetooth and performs delay processing according to the MAC address of each circuit breaker;

(3) after the time delay processing, the breaker sends the MAC address through a power line carrier communication channel;

(4) the electric energy meter receives MAC addresses and detects load current, pairing validity is prejudged, if the prejudgment is valid, all the received MAC addresses of the connectable relays are compared with the received MAC addresses, the MAC addresses are sorted according to matching degrees and are used as a secondary sequence table for verification, if connectable objects with differences larger than a certain threshold value are directly abandoned and are not verified, a target with the highest matching degree in unverified objects is selected at each time, the electric energy meter Bluetooth is controlled by an electric energy meter controller to carry out directional connection with the MAC addresses as objects, and because a master-slave mode is preset, the connection does not need permission of slave Bluetooth and passwords, and the electric energy meter enters a transparent transmission mode after the connection is finished;

(5) the electric energy meter entering a relay transparent transmission mode sends a control instruction through a Bluetooth channel and sends a check request to the Bluetooth of the circuit breaker, wherein the check request comprises a check code which is randomly generated;

(6) after the circuit breaker receives the check request, the circuit breaker MCU sends a check code through a power line carrier communication channel;

(7) the electric energy meter compares the received check code with the check code generated before, if the check code is consistent with the check code generated before, the check is considered to be successful, the electric energy meter sends a pairing success instruction to the circuit breaker through the Bluetooth channel, if the check is failed, the MCU controls to disconnect the Bluetooth connection, and performs Bluetooth connection and check on the next target circuit breaker according to the matching degree sequence until the pairing is finally completed or all checks of the check order list are unsuccessful;

(8) after one round of pairing process time T, the electric energy meters and the circuit breakers which are not successfully paired enter the next round of pairing, namely the step (1) is repeated until all pairing is successful.

Preferably, the pairing validity is prejudged by judging whether a load current exceeding a starting current exists during the period of receiving the MAC, if not, the received MAC is not sent by the connected breaker, and the received MAC is judged to be invalid, otherwise, the received MAC is judged to be valid by assuming that the received MAC is sent by the connected breaker.

Preferably, in the first round of pairing, the delay processing manner in the step (2) is that, according to the last 6 bits mantissa X of the breaker MAC address, the delay processing of the interval time X T is performed according to the calculation of the numerical range of 0-63, and T is the minimum time precision of the electric energy meter identification current, in the step (4), if the MAC address is the same with the lower 6 bits, simultaneous transmission occurs, because of the same frequency interference of carrier communication, if the electric energy meter cannot normally receive the MAC address, after the first round of pairing time T, the electric energy meter which is not successfully paired enters the second round of pairing.

Preferably, in the second round of pairing, the circuit breaker in the step (2) firstly calculates the CRC8 on the MAC address, the calculation result takes the lower 6 bits Y, and the time delay processing of the interval time Y × t is carried out again, after the time delay processing, the circuit breaker returns to the step (3), and the electric energy meter returns to the step (4); and after the second round of pairing time T, the electric energy meters which are not successfully paired enter a third round of pairing.

Preferably, in the third round of pairing, the time delay and pairing operation is carried out by generating a random number R (0-3) with a small value, and pairing is carried out after continuously repeating the delay processing until the pairing is finished, wherein the repetition period is T1 and is smaller than T, so that the accelerated pairing is realized.

The invention has the beneficial effects that: according to the invention, the pairing instruction is sent and the verification is realized by means of power line carrier communication, the Bluetooth automatic pairing of the electric energy meter and the circuit breaker can be realized without extra manpower and scanning equipment, and the Bluetooth automatic pairing method is reliable, time-saving and labor-saving.

Detailed Description

The present invention will be described in further detail with reference to specific embodiments.

In this embodiment, the controller of the electric energy meter is an STM32F103 chip, the bluetooth of the electric energy meter is E104-5032A, and the power line carrier communication module is LM 1893. The breaker controller is an STM8L chip, the breaker Bluetooth is SH-BLEM01, and the power line carrier communication module is LM 1893.

A method for automatically pairing an electric energy meter and a circuit breaker based on a power line carrier comprises the following specific steps. Before power-up, the power meter bluetooth E104-5032A is already configured in host mode, and the communication UUID is also changed uniformly as shown below. The breaker Bluetooth SH-BLEM01 is configured to be in a slave mode, is set to be connected without a secret key, automatically enters a transparent transmission mode after being paired, and changes the communication UUID to be consistent with the host Bluetooth.

Service name UUID
Communication service 6E400001B5A3F393E0A9E50E24DC4179
Transmission channel 6E400002B5A3F393E0A9E50E24DC4179
Receiving channel 6E400003B5A3F393E0A9E50E24DC4179

After the electric energy meter and the circuit breaker are electrified and started, the states of the electric energy meter and the circuit breaker are checked, if the pairing is completed, the Bluetooth channel interconnection of the electric energy meter and the circuit breaker is directly realized, if the pairing is not performed or the pairing is not completed, the pairing process is started, the pairing time of each round is set to be T, and the time T is set according to the pairing time of the electric energy meter and the circuit breaker and the number of the circuit breakers. The pairing procedure is as follows.

(1) The electric energy meter firstly controls the electric energy meter Bluetooth to scan and record MAC addresses of all nearby connectable objects through the electric energy meter MCU, and because communication UUIDs of all master and slave Bluetooth are uniformly changed in advance, the master Bluetooth can only scan slave Bluetooth with the same communication UUID.

(2) The circuit breaker MCU reads the MAC address of the circuit breaker Bluetooth through a serial port, before the circuit breaker MCU sends the circuit breaker Bluetooth MAC address for the first time, the rear 6-bit mantissa X of the circuit breaker MAC address is taken, the circuit breaker MAC address is calculated according to the numerical range of 0-63, time delay processing of interval time X t is carried out, t is the minimum time precision of the electric energy meter identification current, and t is 0.25 s.

(3) After the delay process, the circuit breaker then sends the MAC address through the power line carrier communication channel.

(4) And the electric energy meter receives the MAC address and detects the load current, and performs pairing validity prejudgment. If the received MAC is not sent by the connected breaker, the received MAC is judged to be invalid, and the step is continued; otherwise, supposing that the circuit breaker is connected, judging that the received MAC is valid, comparing all received MAC addresses of connectable objects with the MAC addresses, sequencing the MAC addresses from high to low according to matching degrees to serve as a secondary sequence table for verification, directly discarding the connectable objects with differences larger than a certain threshold value without verification, selecting a target with the highest matching degree in the unverified objects every time, controlling Bluetooth of the electric energy meter to perform directional connection with the MAC addresses as objects through the MCU of the electric energy meter, and sending a control instruction to the Bluetooth of the circuit breaker by a Bluetooth channel without permission of the Bluetooth of a slave machine or passwords due to the preset master-slave mode, wherein the connection does not need permission of the Bluetooth of the slave machine or passwords, and enters a transparent transmission mode after the connection is completed, and then sending a verification request to the Bluetooth of the circuit breaker by a Bluetooth channel, wherein the verification request contains a verification code which is randomly generated by the MCU of the electric energy meter.

In this step, if the breaker has the condition that the MAC address is 6 bits lower than the breaker, simultaneous transmission occurs, and if the electric energy meter cannot normally receive the MAC address due to co-frequency interference of carrier communication, the electric energy meter which is not successfully paired enters the second round of pairing after the first round of pairing time T.

During the second round of pairing, the circuit breaker firstly calculates the CRC8 of the MAC address, the calculation result takes the lower 6 bits Y, the time delay processing of the interval time Y x t is carried out again, after the time delay processing, the circuit breaker returns to the step (3) at the moment, and the electric energy meter returns to the step (4). Because of the calculation of the CRC8, the low 6 bits of the original MAC address are the same and will not be the same with the maximum probability, and the first round of pairing is successful and will not enter the second round of pairing, and the probability that the low 6 bits of the second round of pairing are the same is almost 0, which basically can ensure that the second round of pairing is completely successful.

If the pairing is still unsuccessful after the second round of pairing, most of the normal circuit breakers and the electric energy meters are already paired, and the circuit breakers which are not paired are subjected to time delay and pairing operation through random numbers R (0-3) with small values, namely time delay processing of interval time R x t is carried out, and the pairing is carried out after the time delay processing is continuously repeated until the pairing is completed. The repetition period is T1 and is smaller than T, and the accelerated pairing is realized.

(5) And after the circuit breaker receives the check request, the circuit breaker MCU sends back a check code through the power line carrier communication channel.

(6) And the electric energy meter receives the check code and detects the load current, and the validity of the check code is prejudged. If the load current exceeding the starting current exists in the period of checking the receiving of the check code, if the load current does not exist in the period of checking the receiving of the check code, the received check code is not sent by the connected circuit breaker, the receiving check is judged to be invalid, and the step is continued until the time is out; and if the received check code is consistent with the check code generated before, the pairing is considered to be successful, and the electric energy meter sends a pairing success instruction to the circuit breaker through a Bluetooth channel, so that the pairing process is finished. And if the pairing is failed, the Bluetooth of the electric energy meter sends a pairing failure instruction to the Bluetooth of the circuit breaker, then the electric energy meter actively disconnects the Bluetooth connection, and checks the next target according to the matching degree sequence until the pairing is finally completed. And the circuit breakers that failed the pairing are paired for the next round.

The length generated by the check code is different from the MAC address length, so that the check code can be prevented from being mistaken as the MAC address, and the pairing process is prevented from being influenced.

When the power line carrier channel sends the MAC address or the check code, redundant coding processing and repeated transmission are adopted, because the circuit breaker and the electric energy meter are in the same meter box, transmission signals are strong, and after the processing, except the same frequency interference condition, the electric energy meter can reliably receive data.

When each round of MAC transmission is carried out, delay processing is carried out, so as to avoid co-channel interference. Through the different time delay settings of the circuit breakers, the working current of only one circuit breaker can be detected in the same time under most conditions, and if the circuit breakers working simultaneously exist, the two-wheel and three-wheel pairing time delay is carried out, so that the distinguishing is realized. The second round utilizes CRC8 to calculate new delay time, which basically ensures that the delay time of the same tail number is different. And the third round begins, the probability of the device which is not successfully paired is almost 0, and the pairing speed can be accelerated by using a small random number as the delay.

In the invention, the circuit breaker and the corresponding paired target electric energy meter are directly connected by the live wire, the circuit breaker is a load of the target electric energy meter, and the electric energy meter can detect obvious load current when a power line carrier channel of the circuit breaker works. Therefore, the rest electric energy meters which also receive the MAC address or the check code information and do not generate the load current at the same time do not respond, and only the electric energy meters which simultaneously detect the working current of the power line carrier channel respond to the MAC address and the check code information transmitted by the circuit breaker, so that the matching accuracy is greatly improved.

According to the invention, the pairing instruction is sent and the verification is realized by means of power line carrier communication, the Bluetooth automatic pairing of the electric energy meter and the circuit breaker can be realized without extra manpower and scanning equipment, and the Bluetooth automatic pairing method is reliable, time-saving and labor-saving.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于多个蓝牙模块的车辆定位系统及方法

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类