Disclosure of Invention
The application provides a method and a device for detecting the state of equipment in a power line communication network, which can save the bandwidth occupied by a node in the power line communication network for sending heartbeat messages.
The first aspect of the present application provides a method for detecting a device status in a power line communication network, where the method is applied to a power line communication network, the power line communication network includes a controller and a plurality of nodes, nodes in the power line communication network report heartbeat messages step by step according to a tree structure, the controller is a root node, the plurality of nodes are intermediate nodes or leaf nodes, and the controller and the nodes, and the nodes are connected and communicate through power lines, where the method includes: the method comprises the steps that an intermediate node detects the state of an adjacent node in a first detection period, acquires the state information of the adjacent node of the intermediate node, receives a heartbeat message sent by an adjacent subordinate node in a second detection period, wherein the heartbeat message comprises the state information of the subordinate node of the intermediate node and the state information of the adjacent node of the subordinate node of the intermediate node, and the state information of the adjacent node of the intermediate node and the state information of the node included in the heartbeat message are aggregated to obtain the state information of an associated node of the intermediate node, wherein the associated node of the intermediate node comprises the subordinate node of the intermediate node and the adjacent node of the subordinate node of the intermediate node. And the intermediate node carries the state information of the associated node of the intermediate node and the state information of the intermediate node in the heartbeat message and sends the heartbeat message to an adjacent superior node.
The intermediate node aggregates the state information of the adjacent node and the state information of the node included in the received heartbeat message, and then the intermediate node is carried in the heartbeat message and sends the heartbeat message to the adjacent superior node, and each node is not required to send the heartbeat message to the controller, so that the bandwidth occupied by sending the heartbeat message is saved.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the detecting, by the intermediate node, the state of the adjacent node in a first detection period to obtain state information of the adjacent node of the intermediate node specifically includes: the intermediate node judges whether the discovery message sent by the adjacent node of the intermediate node is received in the first detection period, if the intermediate node receives the discovery message sent by the adjacent node of the intermediate node in the first detection period, the intermediate node determines that the adjacent node of the intermediate node is in an online state, and if the intermediate node does not receive the discovery message sent by the adjacent node of the intermediate node in the first detection period, the intermediate node determines that the adjacent node of the intermediate node is in an offline state.
With reference to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the state information of the neighboring node of the intermediate node is represented by a first state bit map, the state information of the node included in the heartbeat packet is represented by a second state bit map, and the state information of each node in the first state bit map and the second state bit map occupies at least one bit. The data volume occupied by the state bit diagram is small, so that the bandwidth occupied by sending the heartbeat messages can be further reduced.
With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the aggregating, by the intermediate node, the state information of the adjacent node of the intermediate node and the state information of the node included in the heartbeat packet to obtain the state information of the intermediate node-associated node specifically includes: and the intermediate node merges the first state bit map table and the second state bit map table to obtain the state information of the associated node of the intermediate node.
With reference to the second possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, after the first period is ended, the intermediate node initializes the first state bitmap table, and after initialization, state information of nodes included in the first state bitmap table is in an offline state.
With reference to the second possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, after the first period ends, the intermediate node determines that the intermediate node is in an offline state, and closes a timer corresponding to the first detection period and the second detection period.
A second aspect of the present application provides a method for detecting a device status in a power line communication network, where the method is applied to a power line communication network, the power line communication network includes a controller and a plurality of nodes, nodes in the power line communication network report heartbeat packets step by step according to a tree structure, the controller is a root node, the plurality of nodes are intermediate nodes or leaf nodes, and the controller and the nodes, and the nodes are connected and communicate through power lines, and the method includes:
the method comprises the steps that a controller detects the state of an adjacent node in a first detection period to obtain the state information of the adjacent node of the controller;
the controller receives heartbeat messages sent by adjacent subordinate nodes in a second detection period, wherein the heartbeat messages comprise state information of the subordinate nodes of the controller and state information of the adjacent nodes of the subordinate nodes of the controller;
the controller aggregates the state information of the adjacent nodes of the controller and the state information of the nodes included in the heartbeat message to obtain the state information of the nodes in the power line communication network;
and the controller updates a network topology table according to the state information of the nodes in the power line communication network.
Because the intermediate node aggregates the state information of the adjacent node and the state information of the node included in the received heartbeat message, the intermediate node is carried in the heartbeat message and sends the heartbeat message to the adjacent superior node, and each node is not required to send the heartbeat message to the controller, thereby saving the bandwidth occupied by sending the heartbeat message.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the detecting, by the controller, a state of an adjacent node in a first detection period, and acquiring state information of the adjacent node of the controller specifically include: the controller judges whether a discovery message sent by an adjacent node of the controller is received in the first detection period, if the controller receives the discovery message sent by the adjacent node of the controller in the first detection period, the controller determines that the adjacent node of the controller is in an online state, and if the controller does not receive the discovery message sent by the adjacent node of the controller in the first detection period, the controller determines that the adjacent node of the controller is in an offline state.
With reference to the second aspect or the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the updating, by the controller, a network topology table according to the state information of the node in the power line communication network specifically includes:
the controller executes the following updating operation according to the state information of all nodes in the power line communication network:
adding a new network-accessing node in the network topology table;
modifying the state of the existing node in the network topology table to be offline or online, and recording the continuous offline times of the offline node;
and deleting nodes which are offline for N times continuously in the network topology table from the network topology table, wherein N is an integer which is greater than or equal to 2.
With reference to the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the state information of the adjacent node of the controller is represented by a first state bit map, the state information of the node included in the heartbeat packet is represented by a second state bit map, and the state information of each node in the first state bit map and the second state bit map occupies at least one bit.
With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the controller aggregates state information of a neighboring node of the controller and state information of a node included in the heartbeat packet to obtain state information of a node in the power line communication network, and specifically includes: and the controller merges the first state bit map and the second state bit map to obtain the state information of the nodes in the power line communication network.
With reference to the second possible implementation manner of the second aspect, in a fifth possible implementation manner of the second aspect, after the first period is ended, the method further includes:
the controller initializes the first state bitmap table, and after initialization, the state information of the nodes in the first state bitmap table is in an off-line state.
The third aspect of the present application provides an intermediate node, the intermediate node is used in a power line communication network, the power line communication network includes a controller and a plurality of nodes, a node in the power line communication network reports heartbeat messages step by step according to a tree structure, the controller is a root node, the plurality of nodes are the intermediate node or a leaf node, connect and communicate through a power line between the controller and the node, between the node and the node, wherein the intermediate node includes:
an obtaining module, configured to detect a state of an adjacent node in a first detection period, and obtain state information of the adjacent node of the intermediate node;
a receiving module, configured to receive, in a second detection period, a heartbeat message sent by a neighboring lower node, where the heartbeat message includes state information of the lower node of the intermediate node and state information of the neighboring node of the lower node of the intermediate node;
a processing module, configured to aggregate state information of an adjacent node of the intermediate node and state information of a node included in the heartbeat packet to obtain state information of an associated node of the intermediate node, where the associated node of the intermediate node includes a lower node of the intermediate node and an adjacent node of the lower node of the intermediate node;
and the sending module is used for carrying the state information of the associated node of the intermediate node and the state information of the intermediate node in the heartbeat message and sending the heartbeat message to an adjacent superior node.
With reference to the third aspect, in a first possible implementation manner of the third aspect, the obtaining module is specifically configured to: judging whether a discovery message sent by an adjacent node of the intermediate node is received in the first detection period, if the intermediate node receives the discovery message sent by the adjacent node of the intermediate node in the first detection period, determining that the adjacent node of the intermediate node is in an online state, and if the intermediate node does not receive the discovery message sent by the adjacent node of the intermediate node in the first detection period, determining that the adjacent node of the intermediate node is in an offline state.
With reference to the third aspect or the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the state information of the neighboring node of the intermediate node is represented by a first state bit map, the state information of the node included in the heartbeat packet is represented by a second state bit map, and the state information of each node in the first state bit map and the second state bit map occupies at least one bit.
With reference to the second possible implementation manner of the third aspect, in a third possible implementation manner of the third aspect, the processing module is specifically configured to: and merging the first state bit map table and the second state bit map table to obtain the state information of the associated node of the intermediate node.
With reference to the second possible implementation manner of the third aspect, in a fourth possible implementation manner of the third aspect, the intermediate node further includes: and the initialization module is used for initializing the first state bitmap table after the first period is finished, wherein the state information of the nodes in the first state bitmap table is in an off-line state after initialization.
With reference to the second possible implementation manner of the third aspect, in a fourth possible implementation manner of the third aspect, the intermediate node further includes: the determining module is used for determining that the intermediate node is in an offline state after the first period is finished, and the timing module is used for closing the timers corresponding to the first detection period and the second detection period.
The fourth aspect of the present application provides a controller, the controller is used in power line communication network, power line communication network includes controller and a plurality of node, node among the power line communication network reports heartbeat packet step by step according to tree structure, the controller is the root node, a plurality of nodes are intermediate node or leaf node, between controller and the node, through power line connection and communication between node and the node, the controller includes:
the detection module is used for detecting the state of the adjacent node in a first detection period and acquiring the state information of the adjacent node of the controller;
a receiving module, configured to receive, in a second detection period, a heartbeat message sent by a neighboring lower node, where the heartbeat message includes state information of the lower node of the controller and state information of the neighboring node of the lower node of the controller;
the processing module is used for aggregating the state information of the adjacent nodes of the controller and the state information of the nodes included in the heartbeat message to obtain the state information of the nodes in the power line communication network;
and the updating module is used for updating the network topology table according to the state information of the nodes in the power line communication network.
With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the detection module is specifically configured to: judging whether a discovery message sent by an adjacent node of the controller is received in the first detection period, if the controller receives the discovery message sent by the adjacent node of the controller in the first detection period, determining that the adjacent node of the controller is in an online state, and if the controller does not receive the discovery message sent by the adjacent node of the controller in the first detection period, determining that the adjacent node of the controller is in an offline state.
With reference to the fourth aspect or the first possible implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the update module is specifically configured to: according to the state information of all nodes in the power line communication network, the following updating operations are executed:
adding a new network-accessing node in the network topology table;
modifying the state of the existing node in the network topology table to be offline or online, and recording the continuous offline times of the offline node;
and deleting nodes which are offline for N times continuously in the network topology table from the network topology table, wherein N is an integer which is greater than or equal to 2.
With reference to the second possible implementation manner of the fourth aspect, in a third possible implementation manner of the fourth aspect, the state information of the adjacent node of the controller is represented by a first state bit map, the state information of the node included in the heartbeat packet is represented by a second state bit map, and the state information of each node in the first state bit map and the second state bit map occupies at least one bit.
With reference to the third possible implementation manner of the fourth aspect, in a fourth possible implementation manner of the fourth aspect, the processing module is specifically configured to: and merging the first state bit map table and the second state bit map table to obtain the state information of the nodes in the power line communication network.
With reference to the second possible implementation manner of the fourth aspect, in a fifth possible implementation manner of the fourth aspect, the apparatus further includes an initialization module, configured to initialize the first state bitmap table after the first period is ended, where state information of a node included in the first state bitmap table after initialization is in an offline state.
The fifth aspect of the present application provides an intermediate node, the intermediate node is used in power line communication network, power line communication network includes controller and a plurality of node, node in the power line communication network reports heartbeat packet step by step according to tree structure, the controller is the root node, a plurality of nodes do intermediate node or leaf node, between controller and the node, through power line connection and communication between node and the node, wherein, the intermediate node includes:
the processor is used for detecting the state of the adjacent node in a first detection period and acquiring the state information of the adjacent node of the intermediate node;
a receiver, configured to receive, in a second detection period, a heartbeat message sent by a neighboring lower node, where the heartbeat message includes state information of the lower node of the intermediate node and state information of the neighboring node of the lower node of the intermediate node;
the processor is further configured to aggregate state information of an adjacent node of the intermediate node and state information of a node included in the heartbeat packet to obtain state information of an associated node of the intermediate node, where the associated node of the intermediate node includes a subordinate node of the intermediate node and an adjacent node of the subordinate node of the intermediate node;
and the transmitter is used for carrying the state information of the associated node of the intermediate node and the state information of the intermediate node in the heartbeat message and transmitting the heartbeat message to the adjacent superior node.
With reference to the fifth aspect, in a first possible implementation manner of the fifth aspect, the processor is specifically configured to: judging whether a discovery message sent by an adjacent node of the intermediate node is received in the first detection period, if the intermediate node receives the discovery message sent by the adjacent node of the intermediate node in the first detection period, determining that the adjacent node of the intermediate node is in an online state, and if the intermediate node does not receive the discovery message sent by the adjacent node of the intermediate node in the first detection period, determining that the adjacent node of the intermediate node is in an offline state.
With reference to the fifth aspect or the first possible implementation manner of the fifth aspect, in a second possible implementation manner of the fifth aspect, the state information of the neighboring node of the intermediate node is represented by a first state bit map, the state information of the node included in the heartbeat packet is represented by a second state bit map, and the state information of each node in the first state bit map and the second state bit map occupies at least one bit.
With reference to the second possible implementation manner of the fifth aspect, in a third possible implementation manner of the fifth aspect, the processor is specifically configured to: and merging the first state bit map table and the second state bit map table to obtain the state information of the associated node of the intermediate node.
With reference to the second possible implementation manner of the fifth aspect, in a fourth possible implementation manner of the fifth aspect, the processor is further configured to: and initializing the first state bitmap table after the first period is finished, wherein the state information of the nodes in the first state bitmap table after initialization is in an off-line state.
With reference to the second possible implementation manner of the fifth aspect, in a fourth possible implementation manner of the fifth aspect, the processor is further configured to: and after the first period is finished, determining that the intermediate node is in an off-line state, and closing the timers corresponding to the first detection period and the second detection period.
The sixth aspect of the present application provides a controller, the controller is used in power line communication network, power line communication network includes controller and a plurality of node, node among the power line communication network reports heartbeat packet step by step according to tree structure, the controller is the root node, a plurality of nodes are intermediate node or leaf node, between controller and the node, through power line connection and communication between node and the node, the controller includes:
the processor is used for detecting the state of the adjacent node in a first detection period and acquiring the state information of the adjacent node of the controller;
a receiver, configured to receive, in a second detection period, a heartbeat message sent by a neighboring lower node, where the heartbeat message includes state information of the lower node of the controller and state information of the neighboring node of the lower node of the controller;
the processor is further configured to aggregate state information of the adjacent nodes of the controller and state information of the nodes included in the heartbeat message to obtain state information of the nodes in the power line communication network, and update a network topology table according to the state information of the nodes in the power line communication network.
With reference to the sixth aspect, in a first possible implementation manner of the sixth aspect, the processor is specifically configured to: judging whether a discovery message sent by an adjacent node of the controller is received in the first detection period, if the controller receives the discovery message sent by the adjacent node of the controller in the first detection period, determining that the adjacent node of the controller is in an online state, and if the controller does not receive the discovery message sent by the adjacent node of the controller in the first detection period, determining that the adjacent node of the controller is in an offline state.
With reference to the sixth aspect or the first possible implementation manner of the sixth aspect, in a second possible implementation manner of the sixth aspect, the processor is specifically configured to: according to the state information of all nodes in the power line communication network, the following updating operations are executed:
adding a new network-accessing node in the network topology table;
modifying the state of the existing node in the network topology table to be offline or online, and recording the continuous offline times of the offline node;
and deleting nodes which are offline for N times continuously in the network topology table from the network topology table, wherein N is an integer which is greater than or equal to 2.
With reference to the second possible implementation manner of the sixth aspect, in a third possible implementation manner of the sixth aspect, the state information of the adjacent node of the controller is represented by a first state bit map, the state information of the node included in the heartbeat packet is represented by a second state bit map, and the state information of each node in the first state bit map and the second state bit map occupies at least one bit.
With reference to the third possible implementation manner of the sixth aspect, in a fourth possible implementation manner of the sixth aspect, the processor is specifically configured to: and merging the first state bit map table and the second state bit map table to obtain the state information of the nodes in the power line communication network.
With reference to the second possible implementation manner of the sixth aspect, in a fifth possible implementation manner of the sixth aspect, the processor is further configured to initialize the first state bitmap table after the first period is ended, and after the initialization, state information of a node included in the first state bitmap table is in an offline state.
The intermediate node provided in the third aspect and the fifth aspect may be configured to perform the method provided in the first aspect, and beneficial effects of the intermediate node may refer to beneficial effects brought by the first aspect and various possible implementation manners, which are not described herein again.
The controller provided in the fourth aspect and the controller provided in the sixth aspect may be configured to execute the method provided in the second aspect, and beneficial effects of the controller provided in the second aspect and possible embodiments may be referred to, and are not described herein again.
The application provides a method and a device for detecting equipment states in a power line communication network, wherein an intermediate node detects states of adjacent nodes in a first detection period, acquires state information of the adjacent nodes of the intermediate node, receives heartbeat messages sent by the adjacent subordinate nodes in a second detection period, the heartbeat messages comprise the state information of the subordinate nodes of the intermediate node and the state information of the adjacent nodes of the subordinate nodes of the intermediate node, then, the intermediate node aggregates the state information of the adjacent nodes and the state information of the nodes included in the heartbeat messages to obtain the state information of the associated nodes of the intermediate node, and finally, the state information of the associated nodes of the intermediate node and the state information of the intermediate node are carried in the heartbeat messages and sent to the adjacent superior nodes. The intermediate node aggregates the state information of the adjacent node and the state information of the node included in the received heartbeat message, and then the intermediate node is carried in the heartbeat message and sends the heartbeat message to the adjacent superior node, and each node is not required to send the heartbeat message to the controller, so that the bandwidth occupied by sending the heartbeat message is saved.
Detailed Description
The method is applied to a power line communication network, the power line communication network comprises a controller and a plurality of nodes, the nodes in the power line communication network report heartbeat messages step by step according to a tree structure, the controller is a root node, the nodes are intermediate nodes or leaf nodes, and the controller and the nodes are connected through power lines and communicate. The controller is used for monitoring the state of each node in the power line communication network, the controller is also called a central node, the leaf nodes are nodes without lower nodes, and the middle nodes are nodes with lower nodes. The power line communication network is, for example, a remote control meter reading system, and correspondingly, the nodes are intelligent electric meters.
Fig. 1 is a schematic diagram of a reporting path of a heartbeat packet of a power line communication network, where the power line communication network includes a controller and 11 nodes, and the nodes report the heartbeat packet to the controller step by step according to a tree structure, in the example shown in fig. 1, 10 nodes are divided into four stages, where a first-stage node includes anode 1 and a node 2, a second-stage node includes a node 3, a node 4, a node 5, and a node 6, and a third-stage node includes a node 7, a node 8, a node 9, anode 10, and anode 11. Wherein, the node 7, the node 8, the node 9, thenode 10, thenode 11 and the node 3 are leaf nodes, thenode 1, the node 2, the node 4, the node 5 and the node 6 are intermediate nodes, and the controller is a root node. It should be noted that the connection relationship of each node shown in fig. 1 only represents the reporting path of the heartbeat packet, and does not represent the actual physical connection relationship of the node.
Fig. 2 is a flowchart of a device status detection method in a power line communication network according to a first embodiment, and referring to fig. 1 and fig. 2, the method according to the first embodiment includes the following steps:
step 101, the intermediate node detects the state of the adjacent node in the first detection period, and obtains the state information of the adjacent node of the intermediate node.
When the power line communication network is formed, each node is configured or self-learned to obtain a discovery list, the discovery list comprises a plurality of nodes, the nodes in the discovery list are adjacent nodes of the node, and each node can monitor messages sent by the adjacent nodes. Specifically, the intermediate node may detect the state of the neighboring node in the following manner: the intermediate node judges whether a discovery message sent by the adjacent node of the intermediate node is received in a first detection period, and if the intermediate node receives the discovery message sent by the adjacent node of the intermediate node in the first detection period, the intermediate node determines that the adjacent node of the intermediate node is in an online state; if the intermediate node does not receive the discovery message sent by the adjacent node of the intermediate node in the first detection period, the intermediate node determines that the adjacent node of the intermediate node is in an offline state. The first detection period is an online state detection period, and the discovery packet may be any existing packet, for example, a data packet, a heartbeat packet, and the like sent by a node, or may be a newly defined packet. If the Network Identifier is the Identifier of the power line communication Network, it is determined that the node belongs to the power line communication Network, and the state information of the node is updated according to the node Identifier. If the network identifier is not the identifier of the power line communication network, the intermediate node determines that the node does not belong to the power line communication network, and does not record the state information of the node.
It should be clear that the division of the neighboring nodes of a certain node is not based on the heartbeat packet reporting path shown in fig. 1, but is determined based on the actual physical connection of the nodes in the power line communication network, and therefore, for a certain node, the neighboring nodes of the node may be an upper node, a lower node, or a node without an upper-lower relationship. In a power line communication network, not only the intermediate node needs to detect the state of an adjacent node, but also the controller and the leaf node need to detect the state information of the adjacent node, and the detection modes of the controller and the leaf node are the same as the detection mode of the intermediate node.
The state information of the neighboring nodes of the intermediate node may be represented in various ways, for example, the state information of the neighboring nodes of the intermediate node is represented in a form of a list, and the table one is a schematic diagram of the state information of the neighboring nodes of the intermediate node.
Watch 1
| Node point | Status information |
| Node |
| 1 | 0 |
| Node 2 | 1 |
| Node 3 | 1 |
| Node 4 | 1 |
As shown in table one, the intermediate node has 4 neighboring nodes, and the state information of each node is represented by 1 bit (bit), where a state of the node is offline when the state information is 0, and online when the state information is 1. Of course, the status information may also be represented by more bits, or the status information may be represented by tube and false, where tube indicates that the node is online, and false indicates that the node is offline.
The state information of the adjacent nodes of the intermediate node can also be represented by a state bit diagram, the state information of each node in the state bit diagram occupies at least one bit, and the state information of each node is represented by the value of the bit. Taking the example shown in the first table as an example, the intermediate node includes 4 nodes, the state information of each node occupies one bit, fig. 3 is a state bit graph of a neighboring node of the intermediate node, as shown in fig. 3, the state bit graph includes 4 bits, each bit represents the state information of one node, the 4 bits sequentially represent the states ofnode 1, node 2, node 3, and node 4 from left to right, in the example shown in fig. 3, a value of a bit of 1 represents that the state of a node is online, and a value of a bit of 0 represents that the state of a node is offline. Of course, 0 may be used to indicate that the node is online, and 1 may be used to indicate that the node is offline. The state bit diagram represents the state information of the adjacent nodes of the node, so that the storage space occupied by the state information of the adjacent nodes of the storage node can be reduced.
And 102, the intermediate node receives a heartbeat message sent by the adjacent subordinate node in a second detection period, wherein the heartbeat message comprises the state information of the subordinate node of the intermediate node and the state information of the adjacent node of the subordinate node of the intermediate node.
The second detection period is a heartbeat message reporting period, all nodes (including an intermediate node and a leaf node) except the controller in the power line communication network send heartbeat messages to an adjacent upper node, the heartbeat messages reported by the leaf node include state information of the adjacent node of the leaf node and state information of the leaf node, and the heartbeat messages reported by the intermediate node include state information of a lower node of the intermediate node and state information of the adjacent node of the lower node of the intermediate node. The lower nodes of the intermediate node are all lower nodes (including adjacent lower nodes and non-adjacent lower nodes) passing through the intermediate node in a reporting path of the heartbeat message. In the power line communication network shown in fig. 1, when the intermediate node is the node 4, the lower nodes of the node 4 are the node 7, the node 8, and the node 9. When the intermediate node isnode 1, the lower nodes ofnode 1 include node 3, node 4, node 7, node 8, and node 9. When the intermediate node is the node 5, the lower node of the node 5 is thenode 10. When the intermediate node is the node 6, the lower node of the node 6 is thenode 11. When the intermediate node is the node 2, the lower nodes of the node 2 are the node 5, the node 6, thenode 10, and thenode 11.
Optionally, the state information of the subordinate node of the intermediate node and the state information of the neighboring node of the subordinate node of the intermediate node are represented by a second state bitmap, and the state information of each node in the state bitmap occupies at least one bit. That is, the state information of the nodes included in the heartbeat message is represented by the state bitmap, and the data volume occupied by the state bitmap is small, so that the bandwidth occupied by sending the heartbeat message can be reduced. Of course, the state information of the nodes in the heartbeat message may also be represented in a list or other form.
Step 103, the intermediate node aggregates the state information of the adjacent node of the intermediate node and the state information of the node included in the heartbeat message to obtain the state information of the intermediate node associated node.
The related nodes of the intermediate node comprise lower nodes of the intermediate node and adjacent nodes of the lower nodes of the intermediate node.
And step 104, the intermediate node carries the state information of the associated node of the intermediate node and the state information of the intermediate node in the heartbeat message and sends the heartbeat message to the adjacent superior node.
The node reports heartbeat messages step by step in a power line communication network according to a tree structure, specifically, a leaf node reports the heartbeat message of the node, the heartbeat message reported by the leaf node comprises state information of an adjacent node of the leaf node and the state information of the leaf node, the leaf node sends the heartbeat message to an adjacent upper node, the adjacent upper node aggregates the state information of the node, the state information of the adjacent node and the state information of the node contained in the received heartbeat message, carries the aggregated state information in the heartbeat message and sends the heartbeat message to the adjacent upper node, and the like, and finally sends the heartbeat message to a controller.
For an intermediate node, it may receive heartbeat messages sent by multiple neighboring lower nodes, and the intermediate node may aggregate state information of nodes included in the heartbeat messages sent by all neighboring lower nodes with state information of its own neighboring node, and since the state information of nodes included in the heartbeat messages sent by multiple neighboring lower nodes may be repeated, the intermediate node aggregates the state information of the neighboring nodes of the intermediate node and the state information of the nodes included in the heartbeat messages, to obtain state information of nodes associated with the intermediate node, that is, delete the state information of the repeated nodes. The related nodes of the intermediate node comprise lower nodes of the intermediate node and adjacent nodes of the lower nodes of the intermediate node.
When the state information of the adjacent node of the intermediate node is represented by the first state bit diagram and the state information of the node included in the heartbeat message is represented by the second state bit diagram, the intermediate node aggregates the state information of the adjacent node of the intermediate node and the state information of the node included in the heartbeat message to obtain the state information of the intermediate node-associated node, which specifically comprises the following steps: and the intermediate node merges the first state bit diagram and the second state bit diagram to obtain the state information of the associated node of the intermediate node.
In an existing heartbeat message reporting mechanism, each node sends a heartbeat message to a controller, an intermediate node not only needs to send the heartbeat message of the intermediate node to an adjacent upper node, but also needs to forward the heartbeat message of a lower node to the adjacent upper node, and a large amount of bandwidth can be occupied when the intermediate node sends the heartbeat message. In the reporting mechanism of this embodiment, the intermediate node receives the heartbeat message sent by the adjacent lower node, synthesizes the state information of its own adjacent node and the state information of the node included in the heartbeat message, and then sends the heartbeat message to the adjacent upper node, and the controller finally receives only the heartbeat message sent by the adjacent lower node, thereby saving the bandwidth occupied by sending the heartbeat message. Especially in large-scale networking, the number of nodes included in the power line communication network is large, and the bandwidth occupied by the reported heartbeat message can be remarkably reduced by the method of the embodiment.
In addition, in the conventional heartbeat message reporting mechanism, because each node sends a heartbeat message to the controller, the heartbeat message volume is large, so that in order to ensure effective utilization of bandwidth resources, the reporting period of the heartbeat message is generally prolonged, and the occupancy rate of the heartbeat message in the whole bandwidth is reduced. However, the set reporting period of the heartbeat message is too long, which may result in too long offline judgment time, and after the node is offline, the controller may not find that the node is offline in time, and still may send a message to the node, and at this time, the node may not receive the message sent by the controller because the node is offline. After the scheme of the embodiment is adopted, because the heartbeat messages are reduced, the bandwidth occupied by reporting the heartbeat messages is also reduced, so that the reporting period of the heartbeat messages can be reduced, and under the condition of the same bandwidth occupancy rate, the reporting period of the heartbeat messages is reduced, and the online judgment time of the nodes can be reduced.
Taking the power line communication network shown in fig. 1 as an example, the reporting process of the heartbeat message is described in detail. After the second detection period is finished, the node 7, the node 8 and the node 9 respectively send heartbeat messages to the node 4, thenode 10 sends heartbeat messages to the node 5, and thenode 11 sends heartbeat messages to the node 6. The heartbeat message sent by the node 7 includes state information of a neighboring node of the node 7 and state information of the node 7, the heartbeat message sent by the node 8 includes state information of a neighboring node of the node 8 and state information of the node 8, the heartbeat message sent by the node 9 includes state information of a neighboring node of the node 9 and state information of the node 9, the heartbeat message sent by thenode 10 includes state information of a neighboring node of thenode 10 and state information of thenode 10, and the heartbeat message sent by thenode 11 includes state information of a neighboring node of thenode 11 and state information of thenode 11. The adjacent nodes of the node 7, the node 8 and the node 9 may be the same or different, and the second detection periods of the node 7, the node 8 and the node 9 may be the same or different, that is, the node 4 may receive the heartbeat messages sent by the node 7, the node 8 and the node 9 at the same time, or may not receive the heartbeat messages sent by the node 7, the node 8 and the node 9 at the same time. Similarly, the second detection periods of thenode 10 and thenode 11 may be the same or different. After the second detection period is finished, the node 4 aggregates the state information of the node included in the heartbeat messages sent by the nodes 7, 8 and 9 and the state information of the adjacent nodes of the node 4 to obtain the state information of the associated nodes of the node 4. After the node 4 obtains the state information of the associated node, the state information of the node 4 and the state information of the associated node of the node 4 are carried in a heartbeat message and sent to the node 2, the node 3 also sends the heartbeat message to the node 2, the heartbeat message sent by the node 3 comprises the state information of the node 3 and the state information of the adjacent node of the node 3, and the node 2 aggregates the state information of the node and the state information of the adjacent node of the node 2, which are contained in the heartbeat messages sent by the node 4 and the node 3, so as to obtain the state information of the associated node of the node 2. After obtaining the state information of the associated node, the node 2 carries the state information of the associated node of the node 2 and the state information of the node 2 in the heartbeat message and sends the heartbeat message to the controller. Similarly, the node 2 also sends a heartbeat message to the controller, and the heartbeat message sent by the node 2 includes own state information of the node 2, the node 5, the node 6, thenode 10 and thenode 11 and state information of adjacent nodes. The controller aggregates the state information of the nodes and the state information of the adjacent nodes in the heartbeat messages sent by thenodes 1 and 2 to obtain the state information of the nodes in the power line communication network.
Optionally, after the first detection period is ended, the intermediate node initializes the first state bitmap table, and the state information of the node included in the initialized first state bitmap table is in an offline state, that is, the initial state information of the adjacent node of the first node is offline. Subsequently, when detecting that a certain adjacent node is online, the state information of the node is updated.
Optionally, after the first period is ended, the intermediate node determines that the intermediate node is in an offline state, and closes the timers corresponding to the first detection period and the second detection period. The intermediate node can determine whether the intermediate node is in an offline state in several ways: (1) in a first detection period, whether a beacon frame sent by a controller is received or not is judged, the controller broadcasts the beacon frame in the network in the first detection period, if the intermediate node receives the beacon frame in the first detection period, the intermediate node is determined to be in an online state, and if the intermediate node does not receive the beacon frame in the first detection period, the intermediate node is determined to be in an offline state. (2) The intermediate node receives indication information sent by the controller in a first detection period, wherein the indication information is used for indicating that the intermediate node is off-line. (3) The intermediate node receives the SNID sent by the controller in a first detection period, judges whether the received SIND is the same as the SNID stored locally, if the received SNID is different from the SNID stored locally, the intermediate node indicates that the intermediate node is in an offline state and moves to other networks, and if the received SNID is the same as the SNID stored locally, the intermediate node indicates that the intermediate node is in an online state.
In this embodiment, the intermediate node detects the state of the adjacent node in the first detection period, obtains the state information of the adjacent node of the intermediate node, receives the heartbeat message sent by the adjacent subordinate node in the second detection period, where the heartbeat message includes the state information of the subordinate node of the intermediate node and the state information of the adjacent node of the subordinate node of the intermediate node, and then the intermediate node aggregates the state information of the adjacent node and the state information of the node included in the heartbeat message to obtain the state information of the intermediate node-associated node, and finally carries the state information of the intermediate node-associated node and the state information of the intermediate node in the heartbeat message to send to the adjacent superior node. The intermediate node aggregates the state information of the adjacent node and the state information of the node included in the received heartbeat message, and then the intermediate node is carried in the heartbeat message and sends the heartbeat message to the adjacent superior node, and each node is not required to send the heartbeat message to the controller, so that the bandwidth occupied by sending the heartbeat message is saved.
Fig. 4 is a flowchart of a device status detection method in a power line communication network according to a second embodiment, where the first embodiment describes the method from the perspective of an intermediate node, and the second embodiment describes the method from the perspective of a controller, and with reference to fig. 1 and 4, the method according to the second embodiment includes the following steps:
step 201, the controller detects the state of the adjacent node in the first detection period, and obtains the state information of the adjacent node of the controller.
Specifically, the controller judges whether a discovery message sent by an adjacent node of the controller is received in a first detection period, and if the controller receives the discovery message sent by the adjacent node of the controller in the first detection period, the controller determines that the adjacent node of the controller is in an online state; if the controller does not receive the discovery message sent by the adjacent node of the controller in the first detection period, the controller determines that the adjacent node of the controller is in an offline state. It should be noted that, the neighboring nodes of the controller are not determined according to the heartbeat packet reporting path shown in fig. 1, but are determined according to the actual physical connection of the nodes in the power line communication network.
The state information of the adjacent nodes of the controller may also be represented by a state bit diagram or a list, where the state information of each node in the state bit diagram occupies at least one bit, and the specific form may refer to the representation form of the state information of the intermediate node in the first embodiment, which is not described herein again.
Step 202, the controller receives a heartbeat message sent by an adjacent subordinate node in a second detection period, where the heartbeat message includes state information of the subordinate node of the controller and state information of the adjacent node of the subordinate node of the controller.
The state information of the node included in the heartbeat message can also be represented by a state bit diagram or a list. Wherein, the state information of each node in the state bitmap table occupies at least one bit.
And 203, the controller aggregates the state information of the adjacent nodes of the controller and the state information of the nodes included in the heartbeat message to obtain the state information of the nodes in the power line communication network.
When the state information of the adjacent node of the controller is represented by the first state bit diagram and the state information of the node included in the heartbeat message is represented by the second state bit diagram, the controller aggregates the state information of the adjacent node of the controller and the state information of the node included in the heartbeat message to obtain the state information of the node in the power line communication network, and the method specifically comprises the following steps: and the controller merges the first state bit diagram and the second state bit diagram to obtain the state information of the nodes in the power line communication network.
And step 204, the controller updates the network topology table according to the state information of the nodes in the power line communication network.
Specifically, the controller executes the following updating operation according to the state information of all nodes in the power line communication network:
(1) adding a new network-accessing node in the network topology table;
(2) modifying the state of the existing node in the network topology table to be offline or online, and recording the continuous offline times of the offline node;
(3) and deleting nodes which are offline for N times continuously in the network topology table from the network topology table, wherein N is an integer which is greater than or equal to 2.
And the controller deletes the nodes which are offline for N times continuously in the network topology table from the network topology table, namely, the off-network operation is performed on the nodes. It should be emphasized that the node online referred to in this application means that the node is in the network, and the communication quality is good, and the node can receive the effective message. The node offline means that the node is in the network, but the communication quality is not good, and the node cannot receive effective messages. Node off-network means that the node has poor communication quality, cannot receive effective messages and leaves the network.
Optionally, after the first period is ended, the controller initializes the first state bitmap table, and the state information of the node included in the initialized first state bitmap table is in an offline state.
In this embodiment, the controller detects the state of the adjacent node in the first detection period, obtains the state information of the adjacent node of the controller, receives the heartbeat packet sent by the adjacent subordinate node in the second detection period, where the heartbeat packet includes the state information of the subordinate node of the controller and the state information of the adjacent node of the subordinate node of the controller, and then the controller aggregates the state information of the adjacent node and the state information of the node included in the heartbeat packet to obtain the power line communication network, and finally updates the network topology table according to the state information of the node in the power line communication network. The controller only receives the heartbeat messages sent by the adjacent subordinate nodes, thereby saving the bandwidth occupied by sending the heartbeat messages.
Fig. 5 is a schematic structural diagram of an intermediate node provided in the third embodiment, where the intermediate node is applied in a power line communication network, the power line communication network includes a controller and multiple nodes, the nodes in the power line communication network report heartbeat packets step by step according to a tree structure, the controller is a root node, the multiple nodes are the intermediate node or leaf nodes, and the intermediate node is connected and communicates with the nodes through power lines, as shown in fig. 5, and the intermediate node includes:
an obtainingmodule 21, configured to detect a state of an adjacent node in a first detection period, and obtain state information of the adjacent node of the intermediate node;
a receivingmodule 22, configured to receive, in a second detection period, a heartbeat packet sent by a neighboring lower node, where the heartbeat packet includes state information of the lower node of the intermediate node and state information of the neighboring node of the lower node of the intermediate node;
aprocessing module 23, configured to aggregate state information of an adjacent node of the intermediate node and state information of a node included in the heartbeat packet, to obtain state information of an associated node of the intermediate node, where the associated node of the intermediate node includes a lower node of the intermediate node and an adjacent node of the lower node of the intermediate node;
and the sendingmodule 24 is configured to carry the state information of the associated node of the intermediate node and the state information of the intermediate node in the heartbeat packet and send the heartbeat packet to an adjacent higher node.
Optionally, the obtainingmodule 21 is specifically configured to: judging whether a discovery message sent by an adjacent node of the intermediate node is received in the first detection period, if the intermediate node receives the discovery message sent by the adjacent node of the intermediate node in the first detection period, determining that the adjacent node of the intermediate node is in an online state, and if the intermediate node does not receive the discovery message sent by the adjacent node of the intermediate node in the first detection period, determining that the adjacent node of the intermediate node is in an offline state.
Optionally, the state information of the adjacent node of the intermediate node is represented by a first state bit diagram, the state information of the node included in the heartbeat packet is represented by a second state bit diagram, and the state information of each node in the first state bit diagram and the second state bit diagram occupies at least one bit. Correspondingly, theprocessing module 23 is specifically configured to: and merging the first state bit map table and the second state bit map table to obtain the state information of the associated node of the intermediate node.
Optionally, the intermediate node further includes: an initializing module (not shown in fig. 5), configured to initialize the first state bitmap table after the first period ends, where state information of a node included in the first state bitmap table after initialization is in an offline state.
Optionally, the intermediate node further includes: a determining module and a timing module (not shown in fig. 5), where the determining module is configured to determine that the intermediate node is in an offline state after the first period is ended; the timing module is used for closing the timers corresponding to the first detection period and the second detection period.
The intermediate node in this embodiment may be configured to execute the method executed by the intermediate node in the first embodiment and the method executed by the intermediate node in the second embodiment, and the specific implementation manner and the technical effect are similar, and are not described herein again.
Fig. 6 is a schematic structural diagram of a controller provided in the fourth embodiment, where the controller is applied to a power line communication network, the power line communication network includes the controller and a plurality of nodes, nodes in the power line communication network report heartbeat packets step by step according to a tree structure, the controller is a root node, the plurality of nodes are intermediate nodes or leaf nodes, and the controller and the nodes, and the nodes are connected and communicate through power lines, as shown in fig. 6, the controller includes:
the detectingmodule 31 is configured to detect a state of an adjacent node in a first detection period, and acquire state information of the adjacent node of the controller;
a receivingmodule 32, configured to receive, in a second detection period, a heartbeat packet sent by a neighboring lower node, where the heartbeat packet includes state information of the lower node of the controller and state information of the neighboring node of the lower node of the controller;
theprocessing module 33 is configured to aggregate state information of the adjacent nodes of the controller and state information of the nodes included in the heartbeat packet, so as to obtain state information of the nodes in the power line communication network;
and the updatingmodule 34 is configured to update a network topology table according to the status information of the nodes in the power line communication network.
Optionally, thedetection module 31 is specifically configured to: judging whether a discovery message sent by an adjacent node of the controller is received in the first detection period, if the controller receives the discovery message sent by the adjacent node of the controller in the first detection period, determining that the adjacent node of the controller is in an online state, and if the controller does not receive the discovery message sent by the adjacent node of the controller in the first detection period, determining that the adjacent node of the controller is in an offline state.
Optionally, theupdate module 34 is specifically configured to: according to the state information of all nodes in the power line communication network, the following updating operations are executed:
adding a new network-accessing node in the network topology table;
modifying the state of the existing node in the network topology table to be offline or online, and recording the continuous offline times of the offline node;
and deleting nodes which are offline for N times continuously in the network topology table from the network topology table, wherein N is an integer which is greater than or equal to 2.
Optionally, the state information of the adjacent node of the controller is represented by a first state bit diagram, the state information of the node included in the heartbeat packet is represented by a second state bit diagram, and the state information of each node in the first state bit diagram and the second state bit diagram occupies at least one bit. Correspondingly, theprocessing module 33 is specifically configured to: and merging the first state bit map table and the second state bit map table to obtain the state information of the nodes in the power line communication network.
Optionally, the controller further includes an initialization module (not shown in fig. 6), where the initialization module is configured to initialize the first state bitmap table after the first period is finished, and after the initialization, the state information of the node included in the first state bitmap table is in an offline state.
Fig. 7 is a schematic structural diagram of an intermediate node provided in the fifth embodiment, where the intermediate node is applied in a power line communication network, the power line communication network includes a controller and multiple nodes, the nodes in the power line communication network report heartbeat packets step by step according to a tree structure, the controller is a root node, the multiple nodes are the intermediate node or leaf nodes, and theintermediate node 400 includes: aprocessor 41, amemory 42, areceiver 43 and atransmitter 44. Thememory 42, thereceiver 43, and thetransmitter 44 are connected to and communicate with theprocessor 41 through a bus, where thememory 42 is configured to store an instruction, thereceiver 43 is configured to receive data sent by other devices, thetransmitter 44 is configured to send data to other devices, and theprocessor 41 is configured to execute the instruction stored in thememory 42, so that the intermediate node executes the steps executed by the intermediate node in the first and second embodiments of the method, and a specific implementation principle and a technical effect are similar to those of the method embodiment, and are not described herein again.
Fig. 8 is a schematic structural diagram of a controller provided in the sixth embodiment, where the controller is applied to a power line communication network, the power line communication network includes the controller and a plurality of nodes, nodes in the power line communication network report heartbeat packets step by step according to a tree structure, the controller is a root node, the plurality of nodes are intermediate nodes or leaf nodes, and the controller and the nodes, and the nodes are connected and communicate through power lines, as shown in fig. 8, thecontroller 500 includes: aprocessor 51, amemory 52, areceiver 53 and atransmitter 54. Thememory 52, thereceiver 53, and thetransmitter 54 are connected to and communicate with theprocessor 51 through a bus, where thememory 52 is configured to store instructions, thereceiver 53 is configured to receive data sent by other devices, thetransmitter 54 is configured to send data to other devices, and theprocessor 51 is configured to execute the instructions stored in thememory 52, so that the controller point executes the steps executed by the controller in the first and second embodiments of the method, and specific implementation principles and technical effects are similar to those of the method embodiment, and are not described herein again.
It is to be understood that the processor used by an intermediate node or controller in the present application may be a Central Processing Unit (CPU), a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs, and microprocessors, among others.
The bus described herein may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to perform some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.