CN-122001809-A - Internet of things gateway communication method, device, gateway, communication system and storage medium
Abstract
The invention discloses a communication method, a device, a gateway, a communication system and a storage medium for the Internet of things. The method comprises the steps of setting a main communication link and a standby communication link between an Internet of things gateway and a digital base, wherein the main communication link adopts a first communication protocol, the standby communication link adopts a second communication protocol, the anti-interference capability of the second communication protocol is higher than that of the first communication protocol, the Internet of things gateway comprises a first communication interface corresponding to the main communication link and a second communication interface corresponding to the standby communication link, the method comprises the steps of obtaining at least one communication index of the Internet of things gateway under the main communication link, determining that the communication of the main communication link is abnormal if any communication index is greater than or equal to a corresponding threshold value, and switching the communication protocol and the communication interface of the Internet of things gateway to be switched to the standby communication link for communication with the digital base through loading and unloading processing of a protocol stack. The invention can avoid signal interruption between the Internet of things gateway and the digital base caused by electromagnetic interference environment, and ensure the continuity and stability of communication.
Inventors
- WANG SHENG
- JIANG CHUNMIAO
- LI JIE
- LIU JUNYING
- ZHOU WU
- Wei Shichong
Assignees
- 珠海格力电器股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260120
Claims (15)
- 1. The communication method of the Internet of things gateway is characterized in that a main communication link and a standby communication link are arranged between the Internet of things gateway and a digital base, the main communication link adopts a first communication protocol, the standby communication link adopts a second communication protocol, the anti-interference capability of the second communication protocol is stronger than that of the first communication protocol, the Internet of things gateway comprises a first communication interface corresponding to the main communication link and a second communication interface corresponding to the standby communication link, and the method comprises the following steps: acquiring at least one communication index of the Internet of things under the main communication link; if any communication index is greater than or equal to the corresponding threshold value, determining that the communication of the main communication link is abnormal; and switching the communication protocol and the communication interface of the Internet of things gateway by loading and unloading the protocol stack so as to switch to the standby communication link to communicate with the digital base.
- 2. The method of claim 1, wherein obtaining at least one communication indicator of the internet of things under the primary communication link comprises: Counting the continuous timeout times of the heartbeat package, and/or, Calculate the response time for each data request, and/or, And counting the packet loss rate in the data transmission process.
- 3. The method of claim 1, wherein switching the communication protocol and the communication interface of the internet of things gateway to switch to the alternate communication link for communication with the digital base by loading and unloading a protocol stack, comprises: unloading the protocol stack of the first communication protocol and loading the protocol stack of the second communication protocol; processing the data to be sent into a format corresponding to the second communication protocol; and sending the processed data to the second communication interface to transmit the data to the digital base through the standby communication link.
- 4. The method of claim 1, wherein after switching the communication protocol and the communication interface of the internet of things gateway by loading and unloading a protocol stack to switch to the alternate communication link for communication with the digital base, the method further comprises: In the process of communicating with the digital base by using the standby communication link, if the triggering condition is met, the communication protocol and the communication interface of the Internet of things gateway are switched by loading and unloading the protocol stack so as to switch to the main communication link to communicate with the digital base; Judging whether the communication of the main communication link is recovered to be normal or not and whether the communication is normal or not continuously for a preset time; if yes, the main communication link is kept in communication with the digital base; If not, the communication protocol and the communication interface of the Internet of things gateway are switched through loading and unloading processing on the protocol stack, so that the standby communication link is switched to communicate with the digital base.
- 5. The method of claim 4, wherein switching the communication protocol and the communication interface of the internet of things gateway to switch to the primary communication link for communication with the digital base by loading and unloading a protocol stack, comprises: Unloading the protocol stack of the second communication protocol and reloading the protocol stack of the first communication protocol; processing the data to be sent into a format corresponding to the first communication protocol; and sending the processed data to the first communication interface to transmit the data to the digital base through the main communication link.
- 6. The method of claim 4, wherein the trigger condition comprises: Detecting that the Internet of things gateway is in a non-busy state or The communication state of the main communication link of the appointed internet of things gateway within the preset distance around the internet of things gateway is obtained, and the communication state of the main communication link of the appointed internet of things gateway is normal.
- 7. The method according to any one of claims 1 to 6, further comprising: the digital base receives data sent by the internet of things; the digital base judges whether a communication protocol adopted by the Internet of things gateway changes according to the received data; And if the communication protocol adopted by the Internet of things gateway is changed, the digital base switches a protocol stack to direct a communication route to a corresponding communication endpoint, wherein the digital base comprises a first communication endpoint corresponding to the main communication link and a second communication endpoint corresponding to the standby communication link.
- 8. The method of claim 7, wherein the digital base determining whether a communication protocol employed by the internet of things gateway has changed based on the received data comprises: the digital base identifies the protocol type according to the data packet characteristic field of the received data, compares the identified protocol type with the current protocol type recorded locally, and determines that the communication protocol adopted by the Internet of things gateway changes if the comparison result is different, or And the digital base determines a communication endpoint of the received data, and determines that the communication protocol adopted by the Internet of things gateway changes if the communication endpoint is different from the communication endpoint of the last received data.
- 9. The method of claim 7, wherein the digital chassis switching protocol stack to direct a communication route to a corresponding communication endpoint comprises: if the changed communication protocol is a first communication protocol, the digital base unloads a protocol stack of the second communication protocol, loads the protocol stack of the first communication protocol, and directs a communication route to the first communication endpoint; And if the changed communication protocol is a second communication protocol, the digital base unloads the protocol stack of the first communication protocol, loads the protocol stack of the second communication protocol and directs the communication route to the second communication endpoint.
- 10. The method of any of claims 1 to 6, wherein the primary communication link is an MQTT link and the backup communication link is a modbus_tcp link, wherein the first communication protocol is an MQTT protocol and wherein the second communication protocol is a modbus_tcp protocol.
- 11. The utility model provides a thing networking gateway communication device which characterized in that is provided with main communication link and reserve communication link between thing networking gateway and the digital base, main communication link adopts first communication protocol, reserve communication link adopts the second communication protocol, the interference killing feature of second communication protocol is stronger than first communication protocol, thing networking gateway includes the first communication interface that corresponds to main communication link and corresponds to the second communication interface of reserve communication link, the device includes: the acquisition module is used for acquiring at least one communication index of the Internet of things under the main communication link; the determining module is used for determining that the communication of the main communication link is abnormal if any communication index is greater than or equal to a corresponding threshold value; And the switching module is used for switching the communication protocol and the communication interface of the Internet of things gateway through loading and unloading processing on the protocol stack so as to switch to the standby communication link to communicate with the digital base.
- 12. A gateway is characterized by comprising the gateway communication device of the Internet of things according to claim 11.
- 13. A communication system is characterized by comprising an Internet of things gateway and a digital base, wherein the Internet of things gateway comprises the Internet of things gateway communication device of claim 11.
- 14. The communication system of claim 13, wherein the digital base comprises: The receiving module is used for receiving the data sent by the internet of things; The judging module is used for judging whether the communication protocol adopted by the Internet of things gateway changes according to the received data; And the dynamic switching module is used for switching a protocol stack to direct a communication route to a corresponding communication endpoint under the condition that a communication protocol adopted by the internet of things gateway is changed, wherein the digital base comprises a first communication endpoint corresponding to the main communication link and a second communication endpoint corresponding to the standby communication link.
- 15. A non-transitory computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any of claims 1 to 10.
Description
Internet of things gateway communication method, device, gateway, communication system and storage medium Technical Field The invention relates to the technical field of gateways, in particular to a gateway communication method and device of the Internet of things, a gateway, a communication system and a storage medium. Background Currently, many scenarios involve cloud-edge collaboration architecture, including device layer, edge layer, and platform layer. The device layer refers to terminal devices at a bottom layer and is used for collecting field device data and receiving control of an upper layer, the edge layer comprises a gateway, for example, an internet of things (IoT) gateway is used as an edge node and is responsible for data preprocessing, protocol conversion, edge calculation and the like, and a digital base can be deployed at a cloud or a local server and used as a platform layer to perform data aggregation, analysis, modeling and application support. The device layer collects data, the gateway uploads the data to the digital base, the digital base analyzes and processes the data to obtain a control instruction, and the control instruction is issued to corresponding devices through the gateway so that the devices execute operations corresponding to the control instruction. As shown in fig. 1, which is a schematic diagram of an architecture deployed by the existing subway internet of things, the device layer includes a chilled water pump, a cooling water pump, and other devices related to an air conditioner, the edge layer includes N IoT gateway modules, which are respectively in communication connection with corresponding devices, and the IoT gateway modules communicate with the digital base through a communication ring network by adopting an MQTT (Message Queuing Telemetry Transport, message queue telemetry transport) protocol. In the current communication architecture of the subway digital chassis and IoT gateway, the communication link typically employs MQTT QoS level 1 protocol (QoS is an abbreviation of Quality of Service, meaning quality of service) to ensure reliable delivery of critical control instructions. Although the MQTT protocol has the advantages of light weight, low bandwidth and the like, the MQTT protocol has the following defects in a strong electromagnetic interference environment of a subway tunnel (50 Hz-200 Hz high-frequency harmonic wave is generated when a train runs): The PUBACK confirmation mechanism of the MQTT QoS 1 can trigger a retransmission storm when the packet loss rate is 0.8%, so that the condition of overhigh CPU occupancy rate is induced, the continuous high load of the CPU causes the memory fragmentation of the MQTT client, the PUBACK confirmation packet loss rate is further increased, a vicious circle of 'packet loss, retransmission and CPU overload' is formed, and the automatic restart of the Internet of things is caused when the vicious circle is serious, so that the condition of signal interruption occurs. Aiming at the problem that the subway digital base and the Internet of things gateway in the prior art can break communication under strong electromagnetic interference, no effective solution is proposed at present. Disclosure of Invention The embodiment of the invention provides a communication method, a device, a gateway, a communication system and a storage medium for an Internet of things, which at least solve the problem that a subway digital base and an Internet of things gateway are interrupted in communication under strong electromagnetic interference in the prior art. To solve the above technical problems, an embodiment of the present invention provides a communication method for an internet of things, wherein a main communication link and a standby communication link are provided between the internet of things gateway and a digital base, the main communication link adopts a first communication protocol, the standby communication link adopts a second communication protocol, the anti-interference capability of the second communication protocol is stronger than that of the first communication protocol, the internet of things gateway includes a first communication interface corresponding to the main communication link and a second communication interface corresponding to the standby communication link, the method includes: acquiring at least one communication index of the Internet of things under the main communication link; if any communication index is greater than or equal to the corresponding threshold value, determining that the communication of the main communication link is abnormal; and switching the communication protocol and the communication interface of the Internet of things gateway by loading and unloading the protocol stack so as to switch to the standby communication link to communicate with the digital base. Optionally, acquiring at least one communication index of the internet of things under the main communication link incl