This disclosure relates to power line communication technologies, and in particular, to a power line communication method and an apparatus.
Power line communication (PLC) implemented based on the Low-voltage Power Line Broadband Communication Interoperability Technical Specification greatly facilitates network deployment and installation. Therefore, the PLC is widely applied in the field of Internet of things (IoT). However, effective communication can be performed for a PLC network only after a station (STA) obtains routing information. According to the protocol, the STA can obtain the routing information only in two manners: connecting the STA to the network and periodically evaluating a route. The two manners both take a specific period of time to complete. The time varies depending on a network scale. For example, if a smart home has 150 STAs, the required time is basically more than one minute.
In one case, the PLC network may encounter a scenario in which the PLC network is powered off and then powered on again. Based on the foregoing description, in this scenario, the STA in the PLC network cannot be controlled in at least one minute, which causes low communication efficiency of the PLC network and poor user experience.
This disclosure provides a power line communication method and an apparatus, so that communication of an unconnected station can be implemented, communication efficiency of a PLC network can be improved, and use experience can be improved for a user having a real-time control requirement.
According to a first aspect, this disclosure provides a power line communication method. The method is applied to a PLC network. The PLC network includes a first station, a second station, and a central coordinator (CCO). At least one of the first station and the second station is an unconnected station. The method includes the following steps.
In an nth networking process of the PLC network, the first station determines whether to send a packet, where n>1. When determining to send the packet, the first station sends a first broadcast packet. The first broadcast packet includes a first network identifier (NID), a terminal equipment identifier (TEI), and a media access control (MAC) address, the first NID is determined by the CCO in an (n−1)th networking process of the PLC network, and the TEI uses a preset value.
The second station receives the first broadcast packet, where the first broadcast packet includes the first NID, the TEI, and a first MAC address. When the TEI uses the preset value, the second station determines whether the first NID is consistent with a second NID stored in a power-off non-volatile storage medium, where the second NID is determined by the CCO in the (n−1)th networking process of the PLC network. The second station processes the first broadcast packet when the first NID is consistent with the second NID, or the second station discards the first broadcast packet when the first NID is inconsistent with the second NID.
In this embodiment of this disclosure, a broadcast packet of a new type is set, and communication of the unconnected station can be implemented by using an NID obtained in a previous network connection and a specially set TEI value. In this way, communication efficiency of the PLC network can be improved, and use experience can be improved for a user having a real-time control requirement.
In this embodiment of this disclosure, in the nth networking process of the PLC network, the first station serving as a transmit end has been either connected to the network or not connected to the network. In a case in which the first station has been connected to the network, the first station communicates with another connected station. Both the first station and the other connected station have obtained an NID for a current networking, and a TEI and routing information that are allocated by the CCO to the first station and the other connected station. Therefore, the first station may communicate with the other connected station with reference to a protocol specification. Details are not described herein again.
In this embodiment of this disclosure, in the nth networking process of the PLC network, the second station serving as a receive end has been either connected to the network or not connected to the network. In a case in which the second station has been connected to the network, the second station communicates with another connected station. Both the second station and the other connected station have obtained an NID for the current networking, and a TEI and routing information that are allocated by the CCO to the second station and the other connected station. Therefore, the second station may communicate with the other connected station with reference to a protocol specification. Details are not described herein again.
This embodiment of this disclosure mainly relates to three cases. The first station is a connected station and the second station is an unconnected station, or the first station is an unconnected station and the second station is a connected station, or both the first station and the second station are unconnected stations. It can be learned that in the foregoing three cases, at least one of the first station and the second station cannot obtain the NID for the current networking, and cannot perform communication with reference to the protocol specification. Therefore, the power line communication method provided in this disclosure formally resolves such a problem.
When the first station is an unconnected station, the first station includes a first NID stored in the power-off non-volatile storage medium (for example, a flash), and the first NID is determined by the CCO in the (n−1)th networking process of the PLC network. When the first station is a connected station, the first station includes a second NID and the first NID stored in the flash, and the second NID is determined by the CCO in the nth networking process of the PLC network.
When the second station is an unconnected station, the second station includes a second NID stored in the power-off non-volatile storage medium (for example, the flash), and the second NID is determined by the CCO in the (n−1)th networking process of the PLC network. When the second station is a connected station, the second station includes a third NID and the second NID stored in the flash, and the third NID is determined by the CCO in the nth networking process of the PLC network. It should be noted that the foregoing Mth NID and the (M′)th NID mentioned in the foregoing description of the first station represent NIDs having different meanings. Even if values of M and M′ are equal, they do not represent a same NID.
As a transmit end, the first station may monitor whether there is a packet to be sent. If there is a packet to be sent, the first station performs the following steps. If there is no packet to be sent, the first station waits until the nth networking of the PLC network is completed.
The first broadcast packet includes the first NID, the TEI, and a destination MAC address, the first NID is determined by the CCO in the (n−1)th networking process of the PLC network, and the TEI uses the preset value.
Corresponding to the first station serving as the transmit end, the second station serving as the receive end receives the first broadcast packet, which also includes three parts: the first NID (an NID for a previous networking that is obtained by the first station), the TEI (for example, 0), and the first MAC address (an expected destination MAC address of the first broadcast packet sent by the first station).
The Low-voltage Power Line Broadband Communication Interoperability Technical Specification specifies a PLC frame format. As shown in
In this embodiment of this disclosure, the foregoing frame structure is improved, and a modified part includes a frame control and a MAC header.
Considering that at least one of the first station and the second station is an unconnected station, and the unconnected station does not know the NID determined by the CCO in the nth networking process of the PLC network, to ensure that the second station serving as the receive end can receive and correctly parse the first broadcast packet, the first NID is written into an NID field in the first broadcast packet.
The CCO allocates a TEI to the connected station. The TEI needs to be a valid TEI greater than 0. Therefore, if an OSTEI field in a broadcast packet is the valid TEI greater than 0, the broadcast packet is considered as a standard broadcast. The CCO has not allocated a TEI to the unconnected station. Therefore, when the corresponding unconnected station sends a broadcast packet, an OSTEI field is fixedly filled with 0, which is equivalent to adding a special identifier to a new type of broadcast packet (the first broadcast packet, which may also be referred to as an “unconnected proxy broadcast packet”) provided in this disclosure. In this way, the first broadcast packet and the standard broadcast packet can be distinguished.
In addition, the first broadcast packet further includes the destination MAC address. If a station serving as a destination is an unconnected station, the station does not obtain the TEI allocated by the CCO. Therefore, to identify a destination of the first broadcast packet, a complete destination MAC address needs to be carried in the packet. Correspondingly, a long MAC header needs to be used for a MAC header in the first broadcast packet.
When the TEI uses the preset value, the second station further determines whether the received first broadcast packet can be received by the second station. A determining condition may be determining whether the first NID is consistent with the second NID stored in the flash. As described above, the first NID is an NID that is obtained by the first station in a previous networking and that is included in the first broadcast packet. The second NID stored in the flash is an NID that is obtained by the second station in a previous networking (determined by the CCO in the (n−1)th networking process of the PLC network). If the first NID is consistent with the second NID, it indicates that the second station can receive the first broadcast packet, or if the first NID is inconsistent with the second NID, it indicates that the second station cannot receive the first broadcast packet.
As described above, when the first NID is consistent with the second NID, the second station may receive the first broadcast packet, and may further process the first broadcast packet. The processing process may include the following steps.
As described above, the first MAC address is the expected destination MAC address of the first broadcast packet sent by the first station, and the second MAC address is a MAC address of the second station. Therefore, if the first MAC address is consistent with the second MAC address, it indicates that the second station is an expected destination of the first broadcast packet sent by the first station. If the first MAC address is inconsistent with the second MAC address, it indicates that the second station is not an expected destination of the first broadcast packet sent by the first station.
In this case, although the second station is not the expected destination of the first broadcast packet sent by the first station, the second station may have a function of forwarding the first broadcast packet as a proxy station. Therefore, the second station may obtain the role information of the second station from the flash. The role information indicates a proxy station or a non-proxy station. For example, the role information is identification information stored at a predetermined location. When a value of the identification information is 0, it indicates that the second station is the proxy station. When the value of the identification information is 1, it indicates that the second station is the non-proxy station. It should be understood that the foregoing description of the role information is an example for description, and does not constitute a limitation on the role information. In this embodiment of this disclosure, the role information may be alternatively represented in another manner. This is not limited herein.
In this case, the second station serves as the proxy station, and needs to forward the packet even if the first broadcast packet is not sent to the second station. The second station may forward the first broadcast packet in a broadcast manner.
In this case, the second station serves as the non-proxy station and does not assume a responsibility of forwarding the packet. Therefore, since the first broadcast packet is not sent to the second station, the second station directly discards the first broadcast packet.
In this case, the second station is the expected destination of the first broadcast packet sent by the first station. In this case, the second station reads information about the first broadcast packet, and performs a corresponding operation, for example, initiates a network connection, executes a corresponding response, and the like. In this way, in a networking process of the PLC network, even if there is at least one unconnected station in the first station and the second station, communication between the first station and the second station is not affected.
As described above, if the first NID is inconsistent with the second NID, it indicates that the second station cannot receive the first broadcast packet. In this case, the second station directly discards the first broadcast packet.
Optionally, the second station may receive a second broadcast packet. When the second broadcast packet is consistent with the first broadcast packet, the second station discards the second broadcast packet.
In a possible implementation, a station (the foregoing first station or second station) included in the PLC networking obtains a new NID after being connected to the network in the nth networking process of the PLC network. The new NID is determined by the CCO in the nth networking process of the PLC network. The new NID is stored in the flash.
Optionally, when network connection duration of the station in the nth networking process of the PLC network is greater than or equal to a second preset time (for example, 5 minutes), the foregoing historical NID (determined by the CCO in the (n−1)th networking process of the PLC network) are deleted from the power-off non-volatile storage medium. In this way, it can be ensured that both the connected station and the unconnected station can communicate with each other in a networking process. In addition, after the PLC network is stable (for example, after 5 minutes), a new NID determined in the nth networking of the PLC network can be used for communication.
In a possible implementation, when the network connection duration in the nth networking process of the PLC network is greater than or equal to a first preset time, the role information is obtained, where the role information indicates a proxy station or a non-proxy station. The role information is stored in the flash.
According to a second aspect, this disclosure provides a power line communication method. The method is applied to a CCO in a power line communication PLC network. The PLC network includes a first station, a second station, and the CCO. At least one of the first station and the second station is an unconnected station. The method includes obtaining a first NID, where the first NID is determined in an (n−1)th networking process of the PLC network, and n>1, determining whether the first NID conflicts with another NID of the PLC network, obtaining a target NID when it is determined that the first NID does not conflict with the other NID of the PLC network, where the target NID is the first NID, and starting an nth networking process of the PLC network based on the target NID.
In a possible implementation, the method further includes obtaining the target NID when the first NID conflicts with the other NID of the PLC network, where the target NID is a second NID, and the second NID is different from the first NID.
According to a third aspect, this disclosure provides a first station in a power line communication PLC network. The PLC network includes the first station, a second station, and a CCO. At least one of the first station and the second station is an unconnected station. The first station includes a processing module configured to determine, in an nth networking process of the PLC network, whether to send a packet, where n>1, and a sending module configured to send a first broadcast packet when it is determined to send a packet. The first broadcast packet includes a first NID, a TEI, and a destination MAC address. The first NID is determined by the CCO in an (n−1)th networking process of the PLC network. The TEI uses a preset value.
In a possible implementation, the processing module is further configured to obtain a second NID after being connected to the network in the nth networking process of the PLC network, where the second NID is determined by the CCO in the nth networking process of the PLC network, and store the second NID in a power-off non-volatile storage medium.
In a possible implementation, the processing module is further configured to obtain role information when network connection duration in the nth networking process of the PLC network is greater than or equal to a first preset time, where the role information indicates a proxy station or a non-proxy station, and store the role information in the power-off non-volatile storage medium.
In a possible implementation, when the first station is an unconnected station, the first station includes the first NID stored in the power-off non-volatile storage medium.
In a possible implementation, when the first station is a connected station, the first station includes the second NID and the first NID stored in the power-off non-volatile storage medium, and the second NID is determined by the CCO in the nth networking process of the PLC network.
In a possible implementation, the processing module is further configured to delete the first NID from the power-off non-volatile storage medium when the network connection duration in the nth networking process of the PLC network is greater than or equal to a second preset time.
According to a fourth aspect, this disclosure provides a second station in a power line communication PLC network. The PLC network includes a first station, the second station, and a CCO. At least one of the first station and the second station is an unconnected station. The second station includes a receiving module configured to receive a first broadcast packet, where the first broadcast packet includes a first NID, a TEI, and a first MAC address, and a processing module configured to, when the TEI uses a preset value, determine whether the first NID is consistent with a second NID stored in a power-off non-volatile storage medium, where the second NID is determined by the CCO in an (n−1)th networking process of the PLC network, and process the first broadcast packet when the first NID is consistent with the second NID.
In a possible implementation, the processing module is further configured to determine whether the first MAC address is consistent with a local second MAC address, when the first MAC address is inconsistent with the second MAC address, obtain role information stored in the power-off non-volatile storage medium, and forward the first broadcast packet when the role information indicates a proxy station, or discard the first broadcast packet when the role information indicates a non-proxy station.
In a possible implementation, the processing module is further configured to perform a corresponding operation based on the first broadcast packet when the first MAC address is consistent with the second MAC address.
In a possible implementation, the processing module is further configured to discard the first broadcast packet when the first NID is inconsistent with the second NID.
In a possible implementation, the receiving module is further configured to receive a second broadcast packet. The processing module is further configured to discard the second broadcast packet when the second broadcast packet is consistent with the first broadcast packet.
In a possible implementation, the processing module is further configured to obtain a third NID after being connected to the network in an nth networking process of the PLC network, where the third NID is determined by the CCO in the nth networking process of the PLC network, and store the third NID in the power-off non-volatile storage medium.
In a possible implementation, the processing module is further configured to obtain the role information when network connection duration in the nth networking process of the PLC network is greater than or equal to a first preset time, where the role information indicates a proxy station or a non-proxy station, and store the role information in the power-off non-volatile storage medium.
In a possible implementation, when the second station is an unconnected station, the second station includes the second NID stored in the power-off non-volatile storage medium.
In a possible implementation, when the second station is a connected station, the second station includes the third NID and the second NID stored in the power-off non-volatile storage medium, and the third NID is determined by the CCO in the nth networking process of the PLC network.
In a possible implementation, the processing module is further configured to delete the second NID from the power-off non-volatile storage medium when the network connection duration in the nth networking process of the PLC network is greater than or equal to a second preset time.
According to a fifth aspect, this disclosure provides a CCO in a power line communication PLC network. The PLC network includes a first station, a second station, and the CCO. At least one of the first station and the second station is an unconnected station. The CCO includes a processing module configured to obtain a first NID, where the first NID is determined in an (n−1)th networking process of the PLC network, and n>1, determine whether the first NID conflicts with another NID of the PLC network, and obtain a target NID when it is determined that the first NID does not conflict with the other NID of the PLC network, where the target NID is the first NID, and a networking module configured to start an nth networking process of the PLC network based on the target NID.
In a possible implementation, the processing module is further configured to obtain the target NID when it is determined that the first NID conflicts with the other NID of the PLC network. The target NID is a second NID, and the second NID is different from the first NID.
According to a sixth aspect, this disclosure provides a station, including one or more processors, and a memory configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of the implementations of the first aspect and the second aspect.
According to a seventh aspect, this disclosure provides a CCO, including one or more processors, and a memory configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of the implementations of the third aspect.
According to an eighth aspect, this disclosure provides a computer-readable storage medium, including a computer program. When the computer program is executed on a computer, the computer is enabled to perform the method according to any one of the implementations of the first aspect to the third aspect.
According to a ninth aspect, this disclosure provides a computer program product. The computer program product includes computer program code. When the computer program code is run on a computer, the computer is enabled to perform the method according to any one of the implementations of the first aspect to the third aspect.
To make objectives, technical solutions, and advantages of this disclosure clearer, the following clearly and completely describes the technical solutions in this disclosure with reference to the accompanying drawings in this disclosure. It is clear that the described embodiments are merely some rather than all of embodiments of this disclosure. All other embodiments obtained by a person of ordinary skill in the art based on embodiments of this disclosure without creative efforts shall fall within the protection scope of this disclosure.
In the specification, embodiments, claims, and accompanying drawings of this disclosure, the terms “first”, “second”, and the like are merely intended for distinguishing and description, and shall not be understood as indicating or implying relative importance, or indicating or implying a sequence. In addition, the terms “include”, “have”, and any variant thereof are intended to cover a non-exclusive inclusion, for example, include a series of steps or units. Methods, systems, products, or devices are not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
It should be understood that in this disclosure, “at least one” means one or more, and “a plurality of” means two or more. The term “and/or” is used for describing an association relationship between associated objects, and represents that three relationships may exist. For example, “A and/or B” may represent the following three cases: only A exists, only B exists, and both A and B exist, where A and B may be singular or plural. The character “/” usually indicates an “or” relationship between the associated objects. “At least one of the following” or similar expressions mean any combination of these items, including any combination of single items or a plurality of items. For example, at least one of a, b, or c may indicate a, b, c, a and b, a and c, b and c, or a, b, and c, where a, b, and c may be singular or plural.
A networking process of a PLC network may be performed hierarchically: After being powered on, a CCO periodically sends a beacon. A STA that receives the beacon sends an association request to the CCO, to apply to be connected to the PLC network. After being connected to the network, the STA is a first-level station. After the first-level station is connected to the PLC network, the CCO may arrange a beacon slot for the first-level station to send a discovery beacon. Sending of the discovery beacon may trigger a station around the first-level station to initiate an association request. After a second-level station is connected to the network, the CCO may arrange a beacon slot for the second-level station to send a discovery beacon. Sending of the discovery beacon may trigger a third-level station around the second-level station to initiate an association request. This process is repeated so that a highest-level STA farthest from the CCO can be connected to the PLC network.
In the networking process of the PLC network, tree routing information of each station may be formed. With the routing information, communication can be established from the CCO to the STA, from the STA to the CCO, and between two STAs. For example,
However, according to a protocol, before the STA is connected to the PLC network, there is no routing information and no NID. Therefore, communication cannot be established between STAs. According to the Low-voltage Power Line Broadband Communication Interoperability Technical Specification, a reason for which communication cannot be established when the STA is powered on but is not connected to the network is that the unconnected station does not know an NID of a connected station, a TEI allocated by the CCO, or a route to another station. The unconnected station cannot determine whether a packet should be received, and does not know how to forward the received packet for not having the route, resulting in a communication failure. After power-on, a physical line between stations is connected. As long as a filtering problem of packet receiving and a routing problem of packet forwarding of the unconnected station are resolved, the foregoing problem of the communication failure can be resolved, and stations in the PLC network can communicate with each other after being powered on.
Usually, a location of the station in the PLC network does not change, and therefore, a communication line does not change. Theoretically, networking information (including an NID, a TEI, and a station route) that can be used for communication before the station is powered off can still be used for PLC network communication after the station is powered off and then powered on again. Therefore, it is feasible to use information obtained in a previous networking of the PLC network to resolve the problem of sending and receiving a packet of the unconnected station. For example,
Based on this, this disclosure provides a power line communication method, to implement an objective that a station in a PLC network can communicate after being powered on. The power line communication method may be applied to an nth networking process of the PLC network shown in
In this embodiment of this disclosure, in the nth networking process of the PLC network, the CCO preferentially uses, for re-networking, an NID determined in the (n−1)th networking of the PLC network. In other words, an NID used last time is preferentially used as an NID filled in a beacon to be sent by the CCO. For example, NID=10. If it is found that the NID used last time conflicts with a surrounding NID of the PLC network, NID coordination is performed according to a standard protocol, and an NID is reconfigured. For example, a new NID=11. However, according to a running status of the PLC network, after the PLC network is deployed, a location of the PLC network is fixed, and the NID usually uses a 24-bit number. Therefore, a probability of coordination caused by same NIDs (the protocol specifies that when two NIDs of the PLC network are the same, there is a coordination mechanism to coordinate the same NIDs to different values) is not high. Based on this, it can be ensured at a high probability that an NID used after the PLC network is powered off and then powered on again is the same as a previous NID. Therefore, the CCO preferentially uses, for re-networking, the NID determined in the (n−1)th networking of the PLC network. This not only has data support, but also can improve networking efficiency.
In the nth networking process of the PLC network, the connected station can obtain an NID determined by the CCO in the current networking. In this case, the connected station can obtain two NIDs: one is an NID for a previous networking (stored in a power-off non-volatile storage medium), and the other is the NID for the current networking. The two NIDs may be the same or different. However, the unconnected station cannot obtain the NID determined by the CCO in the current networking. Therefore, only the NID (stored in the power-off non-volatile storage medium) for the previous networking can be obtained. For details about a process in which the station stores the NID for the previous networking, refer to the following description.
Step 301: The first station generates a first broadcast packet.
In this embodiment of this disclosure, in the nth networking process of the PLC network, the first station serving as a transmit end has been either connected to the network or not connected to the network. In a case in which the first station has been connected to the network, the first station communicates with another connected station. Both the first station and the other connected station have obtained an NID for the current networking, and a TEI and routing information that are allocated by the CCO to the first station and the other connected station. Therefore, the first station may communicate with the other connected station with reference to a protocol specification. Details are not described herein again.
This embodiment of this disclosure mainly relates to three cases. The first station is a connected station and the second station is an unconnected station, or the first station is an unconnected station and the second station is a connected station, or both the first station and the second station are unconnected stations. It can be learned that in the foregoing three cases, at least one of the first station and the second station cannot obtain the NID for the current networking, and cannot perform communication with reference to the protocol specification. Therefore, the power line communication method provided in this disclosure formally resolves such a problem.
As described above, when the first station is an unconnected station, the first station includes a first NID stored in the power-off non-volatile storage medium (for example, a flash), and the first NID is determined by the CCO in the (n−1)th networking process of the PLC network. When the first station is a connected station, the first station includes a second NID and the first NID stored in the flash, and the second NID is determined by the CCO in the nth networking process of the PLC network.
As a transmit end, the first station may monitor whether there is a packet to be sent. If there is a packet to be sent, the first station performs the following steps. If there is no packet to be sent, the first station waits until the nth networking of the PLC network is completed.
The first broadcast packet includes the first NID, the TEI, and a destination MAC address, the first NID is determined by the CCO in the (n−1)th networking process of the PLC network, and the TEI uses the preset value.
The Low-voltage Power Line Broadband Communication Interoperability Technical Specification specifies a PLC frame format. As shown in
In this embodiment of this disclosure, the foregoing frame structure is improved, and a modified part includes a frame control and a MAC header.
Considering that at least one of the first station and the second station is an unconnected station, and the unconnected station does not know the NID determined by the CCO in the nth networking process of the PLC network, to ensure that the second station serving as the receive end can receive and correctly parse the first broadcast packet, the first NID is written into an NID field in the first broadcast packet.
The CCO allocates a TEI to the connected station. The TEI needs to be a valid TEI greater than 0. Therefore, if an OSTEI field in a broadcast packet is the valid TEI greater than 0, the broadcast packet is considered as a standard broadcast. The CCO has not allocated a TEI to the unconnected station. Therefore, when the corresponding unconnected station sends a broadcast packet, an OSTEI field is fixedly filled with 0, which is equivalent to adding a special identifier to a new type of broadcast packet (the first broadcast packet, which may also be referred to as an “unconnected proxy broadcast packet”) provided in this disclosure. In this way, the first broadcast packet and the standard broadcast packet can be distinguished.
In addition, the first broadcast packet further includes the destination MAC address. If a station serving as a destination is an unconnected station, the station does not obtain the TEI allocated by the CCO. Therefore, to identify a destination of the first broadcast packet, a complete destination MAC address needs to be carried in the packet. Correspondingly, a long MAC header needs to be used for a MAC header in the first broadcast packet.
Step 302: The first station sends the first broadcast packet.
The first station may send the first broadcast packet after generating the first broadcast packet. As the name implies, the first broadcast packet may be sent in a broadcast form.
Step 303: The second station receives the first broadcast packet.
In this embodiment of this disclosure, in the nth networking process of the PLC network, the second station serving as a receive end has been either connected to the network or not connected to the network. In a case in which the second station has been connected to the network, the second station communicates with another connected station. Both the second station and the other connected station have obtained an NID for the current networking, and a TEI and routing information that are allocated by the CCO to the second station and the other connected station. Therefore, the second station may communicate with the other connected station with reference to a protocol specification. Details are not described herein again.
This embodiment of this disclosure mainly relates to three cases. The first station is a connected station and the second station is an unconnected station, or the first station is an unconnected station and the second station is a connected station, or both the first station and the second station are unconnected stations. It can be learned that in the foregoing three cases, at least one of the first station and the second station cannot obtain the NID for the current networking, and cannot perform communication with reference to the protocol specification. Therefore, the power line communication method provided in this disclosure formally resolves such a problem.
As described above, when the second station is an unconnected station, the second station includes a second NID stored in the power-off non-volatile storage medium (for example, the flash), and the second NID is determined by the CCO in the (n−1)th networking process of the PLC network. When the second station is a connected station, the second station includes a third NID and the second NID stored in the flash, and the third NID is determined by the CCO in the nth networking process of the PLC network. It should be noted that the foregoing Mth NID and the (M′)th NID mentioned in the foregoing description of the first station represent NIDs having different meanings. Even if values of M and M′ are equal, they do not represent a same NID.
Corresponding to the first station serving as the transmit end, the second station serving as the receive end receives the first broadcast packet, which also includes three parts: the first NID (an NID for a previous networking that is obtained by the first station), the TEI (for example, 0), and the first MAC address (an expected destination MAC address of the first broadcast packet sent by the first station).
Step 304: When the TEI uses the preset value, the second station determines whether the first NID is consistent with the second NID stored in the power-off non-volatile storage medium.
The TEI uses the preset value (for example, 0) to indicate that the first broadcast packet is a new type of broadcast packet (the foregoing “unconnected proxy broadcast packet”) provided in this disclosure. However, this embodiment of this disclosure mainly relates to communication of the unconnected station. Therefore, if the TEI does not use the preset value, communication may be performed with reference to a protocol specification. Details are not described herein again.
When the TEI uses the preset value, the second station further determines whether the received first broadcast packet can be received by the second station. A determining condition may be determining whether the first NID is consistent with the second NID stored in the flash. As described above, the first NID is an NID that is obtained by the first station in a previous networking and that is included in the first broadcast packet. The second NID stored in the flash is an NID that is obtained by the second station in a previous networking (determined by the CCO in the (n−1)th networking process of the PLC network). If the first NID is consistent with the second NID, it indicates that the second station can receive the first broadcast packet, or if the first NID is inconsistent with the second NID, it indicates that the second station cannot receive the first broadcast packet.
Step 305: The second station processes the first broadcast packet when the first NID is consistent with the second NID.
As described above, when determining that the first NID is consistent with the second NID, the second station may receive the first broadcast packet, and may further process the first broadcast packet. The processing process may include the following steps.
As described above, the first MAC address is the expected destination MAC address of the first broadcast packet sent by the first station, and the second MAC address is a MAC address of the second station. Therefore, if the first MAC address is consistent with the second MAC address, it indicates that the second station is an expected destination of the first broadcast packet sent by the first station. If the first MAC address is inconsistent with the second MAC address, it indicates that the second station is not an expected destination of the first broadcast packet sent by the first station.
In this case, although the second station is not the expected destination of the first broadcast packet sent by the first station, the second station may have a function of forwarding the first broadcast packet as a proxy station. Therefore, the second station may obtain the role information of the second station from the flash. The role information indicates a proxy station or a non-proxy station. For example, the role information is identification information stored at a predetermined location. When a value of the identification information is 0, it indicates that the second station is the proxy station. When the value of the identification information is 1, it indicates that the second station is the non-proxy station. It should be understood that the foregoing description of the role information is an example for description, and does not constitute a limitation on the role information. In this embodiment of this disclosure, the role information may be alternatively represented in another manner. This is not limited herein.
In this case, the second station serves as the proxy station, and needs to forward the packet even if the first broadcast packet is not sent to the second station. The second station may forward the first broadcast packet in a broadcast manner.
In this case, the second station serves as the non-proxy station and does not assume a responsibility of forwarding the packet. Therefore, since the first broadcast packet is not sent to the second station, the second station directly discards the first broadcast packet.
In this case, the second station is the expected destination of the first broadcast packet sent by the first station. In this case, the second station reads information about the first broadcast packet, and performs a corresponding operation, for example, initiates a network connection, executes a corresponding response, and the like. In this way, in a networking process of the PLC network, even if there is at least one unconnected station in the first station and the second station, communication between the first station and the second station is not affected.
Step 306: The second station discards the first broadcast packet when the first NID is inconsistent with the second NID.
As described above, if the first NID is inconsistent with the second NID, it indicates that the second station cannot receive the first broadcast packet. In this case, the second station directly discards the first broadcast packet.
Optionally, the second station may receive a second broadcast packet. When the second broadcast packet is consistent with the first broadcast packet, the second station discards the second broadcast packet.
To be specific, as shown in
In this embodiment of this disclosure, a broadcast packet of a new type is set, and communication of the unconnected station can be implemented by using an NID obtained in a previous network connection and a specially set TEI value. In this way, communication efficiency of the PLC network can be improved, and use experience can be improved for a user having a real-time control requirement.
In a possible implementation, a station (the foregoing first station or second station) included in the PLC networking obtains a new NID after being connected to the network in the nth networking process of the PLC network. The new NID is determined by the CCO in the nth networking process of the PLC network. The new NID is stored in the flash.
To be specific, in the nth networking process of the PLC network, a network connection status of a station changes dynamically. It is possible that unconnected stations constantly change into connected stations, or that connected stations constantly change into unconnected stations due to an unstable network. However, any connected station may obtain a new NID determined by the CCO in the current networking process (the nth networking process of the PLC network). Therefore, to implement the foregoing method embodiment, the connected station may store the newly obtained NID for the current networking in the power-off non-volatile storage medium, for example, the flash, to facilitate use in a networking process after the PLC network is powered off and then powered on again. It should be noted that, in this embodiment of this disclosure, the new NID determined by the CCO in the nth networking process of the PLC network may be the same as or different from the historical NID determined by the CCO in the (n−1)th networking process of the PLC network. This is not further limited herein.
Optionally, when network connection duration of the station in the nth networking process of the PLC network is greater than or equal to a second preset time (for example, 5 minutes), the foregoing historical NID (determined by the CCO in the (n−1)th networking process of the PLC network) are deleted from the power-off non-volatile storage medium. In this way, it can be ensured that both the connected station and the unconnected station can communicate with each other in a networking process. In addition, after the PLC network is stable (for example, after 5 minutes), a new NID determined in the nth networking of the PLC network can be used for communication.
In a possible implementation, when the network connection duration in the nth networking process of the PLC network is greater than or equal to a first preset time, the role information is obtained, where the role information indicates a proxy station or a non-proxy station. The role information is stored in the flash.
To be specific, in the nth networking process of the PLC network, a role of a station (the foregoing first station or second station) also changes dynamically. The station may change from a proxy station before being powered off into a non-proxy station after being powered off and then being powered on again, or may be a non-proxy station temporarily because the following station has not been connected to the network, or may jump between the proxy station and the non-proxy station due to an unstable network, or the like. Therefore, to reduce turbulence of the PLC network in the nth networking process, the connected station may record a role of the connected station after being connected to the network for the first preset time (for example, two route evaluation periods). A station that records itself as a proxy station may include a proxy station newly connected to the network and a proxy station connected to the network last time.
Based on the embodiment shown in
The CCO preferentially uses the previous NID for networking. If it is found that the NID conflicts with a surrounding NID of the network, the CCO coordinates the NID based on the standard protocol. In this way, it can be ensured at a high probability that the NID of the network is the same after the network is powered off and then powered on again. After the PLC network is deployed, a location is fixed and the NID is a 24-bit number. A probability of coordination caused by same NIDs (the protocol specifies that when two NIDs of the network are the same, there is a coordination mechanism to coordinate the same NID to different values) is not high.
The connected station CCO allocates a TEI. The allocated TEI is necessarily a valid TEI greater than 0. If OSTEI in a proxy broadcast is filled with the valid TEI greater than 0, the proxy broadcast is considered as a standard broadcast. The unconnected station CCO has not allocated a TEI to a station. Therefore, it is specified that OSTEI is fixedly filled with 0 when the unconnected station sends a proxy broadcast packet. Therefore, the proxy broadcast packet with OSTEI being 0 is used as a new type of broadcast packet, which is referred to as an “unconnected proxy broadcast packet”. Meanings of all fields except OSTEI in the unconnected proxy broadcast packet are the same as those in the standard broadcast packet.
If a station receives a proxy broadcast packet with OSTEI being 0, the station does not determine the packet as an invalid packet and discards it. Instead, the station processes the packet as a proxy broadcast packet sent by the unconnected station. For the “unconnected proxy broadcast packet”, both a station whose historical role is the proxy station and a station that is a proxy station in the current network connection are required to forward the packet to ensure that all stations can receive the packet. As shown in
Step (4) is performed if the first station determines to send the packet in the networking process, or step (3) is performed if the first station determines not to send the packet in the networking process.
Step (6) is performed if the first station determines to communicate with the unconnected station, or step (5) is performed if the first station determines not to communicate with the unconnected station.
An NID in this packet is an NID for a previous network connection, OSTEI is 0, and a sending type is a proxy broadcast.
Step (9) is performed if the NID in the packet is the NID for the previous network connection, or step (8) is performed if the NID in the packet is not the NID for the previous network connection.
Step (11) is performed if the station connected to the network last time is a proxy station or the station connected to the network this time is a proxy station, or step (10) is performed if neither the station connected to the network last time is a proxy station nor the station connected to the network this time is a proxy station.
When the station 800 is a first station in the PLC network, the processing module 802 is configured to generate a first broadcast packet in an nth networking process of the PLC network, where n>1, the first broadcast packet includes a first NID and a TEI, the first NID is determined by a CCO in an (n−1)th networking process of the PLC network, and the TEI uses a preset value. The sending module 803 is configured to send the first broadcast packet.
In a possible implementation, the processing module 802 is further configured to obtain a second NID after being connected to the network in the nth networking process of the PLC network, where the second NID is determined by the CCO in the nth networking process of the PLC network, and store the second NID in a power-off non-volatile storage medium.
In a possible implementation, the processing module 802 is further configured to obtain role information when network connection duration in the nth networking process of the PLC network is greater than or equal to a first preset time, where the role information indicates a proxy station or a non-proxy station, and store the role information in the power-off non-volatile storage medium.
In a possible implementation, when the first station is an unconnected station, the first station includes the first NID stored in the power-off non-volatile storage medium.
In a possible implementation, when the first station is a connected station, the first station includes the second NID and the first NID stored in the power-off non-volatile storage medium, and the second NID is determined by the CCO in the nth networking process of the PLC network.
In a possible implementation, the processing module 802 is further configured to delete the first NID from the power-off non-volatile storage medium when the network connection duration in the nth networking process of the PLC network is greater than or equal to a second preset time.
In a possible implementation, the first broadcast packet further includes a destination MAC address.
When the station 800 is a second station in the PLC network, the receiving module 801 is configured to receive a first broadcast packet, where the first broadcast packet includes a first NID and a TEI. The processing module 802 is configured to, when the TEI uses a preset value, determine whether the first NID is consistent with a second NID stored in a power-off non-volatile storage medium, where the second NID is determined by the CCO in an (n−1)th networking process of the PLC network, and process the first broadcast packet when the first NID is consistent with the second NID.
In a possible implementation, the first broadcast packet further includes a first MAC address. The processing module 802 is further configured to determine whether the first MAC address is consistent with a local second MAC address, when the first MAC address is inconsistent with the second MAC address, obtain role information stored in the power-off non-volatile storage medium, and forward the first broadcast packet when the role information indicates a proxy station, or discard the first broadcast packet when the role information indicates a non-proxy station.
In a possible implementation, the processing module 802 is further configured to perform a corresponding operation based on the first broadcast packet when the first MAC address is consistent with the second MAC address.
In a possible implementation, the processing module 802 is further configured to discard the first broadcast packet when the first NID is inconsistent with the second NID.
In a possible implementation, the receiving module 801 is further configured to receive a second broadcast packet. The processing module 802 is further configured to discard the second broadcast packet when the second broadcast packet is consistent with the first broadcast packet.
In a possible implementation, the processing module 802 is further configured to obtain a third NID after being connected to the network in an nth networking process of the PLC network, where the third NID is determined by the CCO in the nth networking process of the PLC network, and store the third NID in the power-off non-volatile storage medium.
In a possible implementation, the processing module 802 is further configured to obtain role information when network connection duration in the nth networking process of the PLC network is greater than or equal to a first preset time, where the role information indicates a proxy station or a non-proxy station, and store the role information in the power-off non-volatile storage medium.
In a possible implementation, when the second station is an unconnected station, the second station includes the second NID stored in the power-off non-volatile storage medium.
In a possible implementation, when the second station is a connected station, the second station includes the third NID and the second NID stored in the power-off non-volatile storage medium, and the third NID is determined by the CCO in the nth networking process of the PLC network.
In a possible implementation, the processing module 802 is further configured to delete the second NID from the power-off non-volatile storage medium when the network connection duration in the nth networking process of the PLC network is greater than or equal to a second preset time.
The station 800 in this embodiment may be configured to execute the technical solution of the method embodiment shown in
The processing module 901 is configured to obtain a first NID, where the first NID is determined in an (n−1)th networking process of the PLC network, and n>1, determine whether the first NID conflicts with another NID of the PLC network, and obtain a target NID when it is determined that the first NID does not conflict with the other NID of the PLC network, where the target NID is the first NID. The networking module 902 is configured to start an nth networking process of the PLC network based on the target NID.
In a possible implementation, the processing module 901 is further configured to obtain the target NID when it is determined that the first NID conflicts with the other NID of the PLC network. The target NID is a second NID, and the second NID is different from the first NID.
The COO 900 in this embodiment may be configured to execute the technical solution of the method embodiment shown in
In an implementation process, steps in the foregoing method embodiments can be implemented by using a hardware integrated logic circuit in the processor, or by using instructions in a form of software. The processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor, or the processor may be another processor or the like. The steps of the methods disclosed in embodiments of this disclosure may be directly presented as being performed and completed by a hardware encoding processor, or performed and completed by a combination of hardware and a software module in an encoding processor. The software module may be located in a mature storage medium in the art, such as a random-access memory (RAM), a flash memory, a read-only memory (ROM), a programmable ROM (PROM), an electrically erasable PROM (EEPROM), or a register. The storage medium is located in the memory, and the processor reads information in the memory and completes the steps in the foregoing methods in combination with hardware of the processor.
The memory in the foregoing embodiments may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. The non-volatile memory may be a ROM, a PROM, an erasable PROM (EPROM), an EEPROM, or a flash memory. The volatile memory may be a RAM, used as an external cache. By way of example, and not limitation, many forms of RAMs may be used, for example, a static RAM (SRAM), a dynamic RAM (DRAM), a synchronous DRAM (SDRAM), a Double Data Rate (DDR) SDRAM, an enhanced SDRAM (ESDRAM), a synchronous link DRAM (SLDRAM), and a Direct Rambus (DR) RAM. It should be noted that the memory of the systems and methods described in this specification includes but is not limited to these and any memory of another proper type.
A person of ordinary skill in the art may be aware that, in combination with the examples described in embodiments disclosed in this specification, units and algorithm steps may be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of this disclosure.
It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and unit, refer to a corresponding process in the foregoing method embodiments. Details are not described herein again.
In several embodiments provided in this disclosure, it should be understood that the disclosed system, apparatus and method may be implemented in another manner. For example, the described apparatus embodiment is merely an example. For example, division into the units is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be in electrical, mechanical, or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected based on actual requirements to achieve the objectives of the solutions of embodiments.
In addition, functional units in embodiments of this disclosure may be integrated into one processing unit, each of the units may exist alone physically, or two or more units are integrated into one unit.
When the functions are implemented in the form of a software functional unit and sold or used as an independent product, the functions may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions in this disclosure may be implemented in a form of a software product. The computer software product is stored in a storage medium and includes several instructions for instructing a computer device (a personal computer, a server, a network device, or the like) to perform all or a part of the steps of the methods in embodiments of this disclosure. The foregoing storage medium includes any medium that can store program code, such as a Universal Serial Bus (USB) flash drive, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disc.
The foregoing descriptions are merely specific implementations of this disclosure, but the protection scope of this disclosure is not limited thereto. Any variation or replacement readily figured out by a person skilled in the art within the technical scope disclosed in this disclosure shall fall within the protection scope of this disclosure. Therefore, the protection scope of this disclosure shall be subject to the protection scope of the claims.
Number | Date | Country | Kind |
---|---|---|---|
202211149991.0 | Sep 2022 | CN | national |
This is a continuation of International Patent Application No. PCT/CN2023/103639 filed on Jun. 29, 2023, which claims priority to Chinese Patent Application No. 202211149991.0 filed on Sep. 21, 2022, which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2023/103639 | Jun 2023 | WO |
Child | 19084968 | US |