CN112367407A - Control method, control device and computer storage medium - Google Patents

Control method, control device and computer storage medium Download PDF

Info

Publication number
CN112367407A
CN112367407A CN202110035774.8A CN202110035774A CN112367407A CN 112367407 A CN112367407 A CN 112367407A CN 202110035774 A CN202110035774 A CN 202110035774A CN 112367407 A CN112367407 A CN 112367407A
Authority
CN
China
Prior art keywords
control
instruction
packet
response
control instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110035774.8A
Other languages
Chinese (zh)
Inventor
童志鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Wiregate Technology Co ltd
Original Assignee
Wuhan Wiregate Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Wiregate Technology Co ltd filed Critical Wuhan Wiregate Technology Co ltd
Priority to CN202110035774.8A priority Critical patent/CN112367407A/en
Publication of CN112367407A publication Critical patent/CN112367407A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/566Grouping or aggregating service requests, e.g. for unified processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention discloses a control method, a control device and a computer storage medium, wherein the control method is applied to a first LoRa gateway and comprises the following steps: receiving a first instruction packet sent by a server, wherein the first instruction packet comprises: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2; respectively sending the first control instruction to the corresponding controlled terminals based on the first instruction packet; receiving a first control response of the first control instruction returned by the controlled terminal; and returning the N first control responses of the first control instruction to the server by carrying the N first control responses in the same first response packet.

Description

Control method, control device and computer storage medium
Technical Field
The present invention relates to the field of wireless communications technologies, and in particular, to a control method, an apparatus, and a computer storage medium.
Background
LoRa (Long Range radio) is a low-power consumption remote data transmission technology based on less than 1GHz, has the advantages of large capacity, low power consumption, wide coverage, strong anti-interference performance, low price and the like, and has obvious advantages in the modification project of an intelligent park.
The LoRa communication system is generally composed of LoRa end nodes, gateways, and servers. Since the coverage area of the LoRa communication system is wide, a large number of LoRa end nodes generally exist in one LoRa communication system, and when the server controls the large number of LoRa end nodes, a significant time delay exists.
Disclosure of Invention
In view of the above, embodiments of the present invention are directed to a control method, an apparatus, and a computer storage medium.
In a first aspect, an embodiment of the present invention provides a control method, applied to a first LoRa gateway, including:
receiving a first instruction packet sent by a server, wherein the first instruction packet comprises: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
respectively sending the first control instruction to the corresponding controlled terminals based on the first instruction packet;
receiving a first control response of the first control instruction returned by the controlled terminal;
and returning the N first control responses of the first control instruction to the server by carrying the N first control responses in the same first response packet.
In one embodiment, the sending the first control instruction to the corresponding controlled terminals respectively based on the first instruction packet includes:
splitting the first instruction packet to obtain the N first control instructions;
and sequentially sending the N first control instructions to the corresponding controlled terminals.
In one embodiment, further comprising: and within a first preset time threshold after the first control instruction is sent, if a first control response of the first control instruction returned by the controlled terminal is not received, the first control instruction is sent again.
In one embodiment, said resending said first control instruction comprises:
and when the retransmission condition of the first control instruction is met, retransmitting the first control instruction.
In one embodiment, the satisfying of the condition for retransmission of the first control instruction includes:
the retransmission times of the first control instruction are less than the preset times;
and/or the presence of a gas in the gas,
the first control instruction is sent within a first preset time threshold; wherein the second preset time threshold is greater than the first preset time threshold.
In one embodiment, the method further comprises:
a first control response of the first control instruction returned by the controlled terminal is not received within a first preset time threshold after the first control instruction is sent, and the receiving failure of the first control response corresponding to the first control instruction is determined if the retransmission condition of the first control instruction is not met;
and generating the first control response of the failed execution of the first control instruction.
In one embodiment, further comprising:
receiving a second instruction packet sent by a server, wherein the second instruction packet comprises: and M second control instructions, one second control instruction, for controlling the controlled terminal in which the execution of the first control instruction fails, wherein M is the number of the first control instructions in which the execution fails.
In a second aspect, an embodiment of the present invention provides a control method, which is applied to a server, and includes:
generating at least one first instruction packet, wherein one first instruction packet corresponds to a first LoRa gateway, and the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
respectively sending the first instruction packets to the corresponding first LoRa gateways;
receiving a first response packet of the first instruction packet returned by the first LoRa gateway, where the first response packet includes: n first control responses of the first control instruction.
In one embodiment, further comprising:
generating a second instruction packet based on the first response packet, wherein the second instruction packet comprises: m second control instructions, one second control instruction, for controlling the controlled terminal that the first control instruction fails to execute, wherein M is the number of the first control instructions that fail to execute;
and sending the second instruction packet to a first LoRa gateway corresponding to the first response packet.
In a third aspect, an embodiment of the present invention provides a control apparatus, which is applied to a first LoRa gateway, and includes:
a first receiving unit, configured to receive a first instruction packet sent by a server, where the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
a first sending unit, configured to send the first control instruction to the corresponding controlled terminals respectively based on the first instruction packet;
a second receiving unit, configured to receive a first control response of the first control instruction returned by the controlled terminal;
and the second sending unit is used for returning the first control responses of the N first control instructions carried in the same first response packet to the server.
In a fourth aspect, an embodiment of the present invention provides a control apparatus, which is applied to a server, and includes:
a generating unit, configured to generate at least one first instruction packet, where one of the first instruction packets corresponds to a first LoRa gateway, and the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
the sending unit is used for respectively sending the first instruction packets to the corresponding first LoRa gateways;
a receiving unit, configured to receive a first response packet of the first instruction packet returned by the first LoRa gateway, where the first response packet includes: n first control responses of the first control instruction.
In a fifth aspect, an embodiment of the present invention provides a computer storage medium, where a computer program is stored, and the computer program is executed to implement any one of the methods provided above.
In the embodiment of the invention, the first LoRa gateway splits the first instruction packet sent by the server, controls different controlled terminals based on a plurality of first control instructions in the first instruction packet, and merges and feeds back control results returned by the different LoRa terminals to the server, so that the server can send the first instruction packet to a plurality of first LoRa gateways at the same time, the plurality of first LoRa gateways respectively send the first control instructions to the control terminals under the first LoRa gateways, and the first LoRa gateways control the controlled terminals in a pair of controlled terminals relative to the server, and the first LoRa gateways directly control the controlled terminals based on the first instruction packet, thereby effectively reducing the control delay difference of the server on different controlled terminals needing to be controlled simultaneously for state switching, and improving the control experience.
Drawings
Fig. 1 is a schematic diagram of a LoRaWAN network architecture according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a first control method applied to a first LoRaWAN gateway according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a second control method applied to the first LoRaWAN gateway according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a first control method applied to a server according to an embodiment of the present invention;
fig. 5 is a flowchart illustrating a second control method applied to a server according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a control device applied to a first LoRaWAN gateway according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a control device applied to a server according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of a prior art LoRaWAN network architecture;
fig. 9 is a schematic diagram of another LoRaWAN network architecture according to an embodiment of the present invention;
fig. 10 is a framework diagram of an edge gateway according to an embodiment of the present invention.
Detailed Description
The technical solution of the present invention is further described in detail with reference to the drawings and the specific embodiments of the specification.
The control method of the embodiment of the invention can be applied to a LoRaWAN network architecture as shown in fig. 1, where the LoRaWAN network architecture includes a server (including a network server and an application server), a first-layer LoRa gateway, a second-layer LoRa gateway and a plurality of controlled terminals, where the first-layer LoRa gateway includes at least two first LoRa gateways, the second-layer LoRa gateway includes at least one second LoRa gateway, each second LoRa gateway is connected to the server, each first LoRa gateway is connected to one second LoRa gateway, and the first LoRa gateway is a direct connection gateway directly connected to a controlled terminal.
It can be understood that, according to the needs of practical applications, the number of the LoRa gateways may be configured according to the needs, the LoRa gateway of the new hierarchy is connected between the second LoRa gateway and the server, and the number of the located number of the number may be named according to the connection distance with the controlled terminal, for example, the third LoRa gateway of the third LoRa gateway is connected with the second LoRa gateway of the second LoRa gateway, the fourth LoRa gateway of the fourth LoRa gateway is connected with the third LoRa gateway of the third LoRa gateway, and so on.
Based on the network architecture, the controlled terminal is connected with the first LoRa gateway through a LoRa wireless communication mode, the LoRa gateways are connected through a LoRa wireless communication mode, and the LoRa gateways are connected with the server through a mobile cellular network (such as a third generation mobile communication technology 3G, a fourth generation mobile communication technology 4G or a fifth generation mobile communication technology 5G), a wireless WiFi network or an Ethernet.
As shown in fig. 2, a control method according to an embodiment of the present invention is applied to a first LoRa gateway, and includes:
step S101: receiving a first instruction packet sent by a server, wherein the first instruction packet comprises: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
step S102: respectively sending the first control instruction to the corresponding controlled terminals based on the first instruction packet;
step S103: receiving a first control response of the first control instruction returned by the controlled terminal;
step S107: and returning the N first control responses of the first control instruction to the server by carrying the N first control responses in the same first response packet.
In this embodiment, the first LoRa gateway receives a first instruction packet sent by the server, where the first instruction packet includes: n first control instructions.
The first control instruction may include: device type, identity of controlled terminal and control indication information. Wherein the device types include: ammeter, lamp accuse etc. controlled terminal's sign can adopt controlled terminal's serial number, and control instruction information includes: opening, closing, opening after a preset time, closing after a preset time, opening at a fixed time, closing at a fixed time, periodically opening, periodically closing and the like. For example, a first control instruction includes: the device type is 001 (indicating lamp control), the controlled terminal is numbered 00000402, and the control instruction information is 00 (indicating off), then the first control instruction is used to control the controlled terminal numbered 11222222 to be off.
In one embodiment, each controlled terminal is detachably arranged on one controlled device, the controlled device receives and executes a first control instruction of the server through the controlled terminal, and generates a first control response and sends the first control response to the server through the controlled terminal. Accordingly, the first control instruction in the above example is used to control the controlled device corresponding to the controlled terminal numbered 11222222 to be closed.
In step S102, the first control commands are sent to the corresponding controlled terminals based on the first command packet.
In one embodiment, the first instruction packet includes: and if the N first control instructions are instructions that can be directly analyzed and/or executed for the controlled terminal, the first LoRa gateway directly splits the first instruction packet into the N first control instructions, and sends the first control instructions to the corresponding controlled terminal based on the identifier of the controlled terminal carried in the first control instructions.
In another embodiment, the first instruction packet includes: and N pieces of related information of the first control instructions. For example, the first instruction packet includes identifiers of N controlled terminals and device types and control instruction information corresponding to the identifiers, and the first LoRa gateway generates N first control instructions that can be directly analyzed and/or executed for the controlled terminals based on the relevant information.
In one embodiment, the controlled terminals configured under one first LoRa gateway are fixed, that is, one controlled terminal communicates with the server through the fixed first LoRa gateway. Specifically, the server stores information of the controlled terminals configured under each first LoRa gateway, for example, the server stores a correspondence table between the first LoRa gateway and the controlled terminals configured under the first LoRa gateway. When generating the first instruction packet, based on the corresponding relationship table, the control information or the first control instruction of the controlled terminal to be controlled under the same first LoRa gateway is collected in the same first instruction packet and sent, and meanwhile, the first instruction packet further includes a corresponding first LoRa gateway identifier, such as a first LoRa gateway number.
For a scene with multiple layers of LoRa gateways, because the server is not directly connected with the first LoRa gateway, the first instruction packet cannot be directly sent to the corresponding first LoRa gateway, so that the first instruction packet can be sent in a preset path routing mode or a shortest path routing mode in the process of being sent to the corresponding first LoRa gateway through the multiple LoRa gateways.
In step S103, a first control response of the first control instruction returned by the controlled terminal is received. The first control response includes a controlled terminal identification and an execution result identification. The identification of the execution result comprises: an execution success flag and an execution failure flag.
In step S107, the first control responses of the N first control instructions are carried in the same first response packet and returned to the server.
In one embodiment, the first response packet includes: and if the N first control responses are instructions that can be directly parsed and/or executed for the server, the first LoRa gateway directly merges the N first control responses into a first response packet and sends the first response packet to the server.
In another embodiment, the first LoRa gateway extracts the controlled terminal identifiers and the corresponding execution result identifiers from the N first control responses, and generates the first response packet including the N controlled terminal identifiers and the corresponding execution result identifiers.
In the embodiment of the invention, the first LoRa gateway splits the first instruction packet issued by the server, controls different controlled terminals based on a plurality of first control instructions in the first instruction packet, and merges and feeds back control results returned by the different LoRa terminals to the server, so that the server can issue the first instruction packet to a plurality of first LoRa gateways at the same time, and the plurality of first LoRa gateways respectively send the first control instructions to the control terminals below the first LoRa gateways.
In one embodiment, the step S102 includes:
step S1021: splitting the first instruction packet to obtain the N first control instructions;
step S1022: and sequentially sending the N first control instructions to the corresponding controlled terminals.
In step S1021, the first LoRa gateway splits the first instruction packet according to the format of the first instruction packet to obtain N first control instructions.
For example, the first instruction packet includes: n first control instructions, wherein the N first control instructions are instructions which can be directly analyzed and/or executed for the controlled terminal. The format of the first instruction packet is shown in table 1 below:
TABLE 1 first Command packet Format (one)
Figure 324307DEST_PATH_IMAGE001
Here, the sequence number is used to indicate a sequence number of the first packet generated by the server, and may be expressed by 2 bytes, for example, 0011; the first LoRa gateway ID is used to identify the destination of the first instruction packet, and may be represented by 2 bytes, for example, 0022; the first control instruction may be represented by 7 bytes, including a frame header, a device ID, a device type, and a command number, where the frame header is used to identify the start of the first control instruction and may be represented by one byte, for example, fixed in "BB"; the device ID is used to identify the controlled terminal and may be represented by 4 bytes, for example, 33222222; the device type indicates the type of device to be controlled, for example, a meter is indicated by "00", and a lamp control is indicated by "01"; the command number is used for a specific control device, for example, for lamp control, turning off the lamp is indicated by "00" and turning on the lamp is indicated by "01".
Of course, the above is only an example of a first instruction packet format, and different fields and field lengths may be set to represent the first instruction packet according to the needs of the practical application.
Then, the first instruction packet is directly analyzed to obtain N first control instructions.
For another example, the first instruction packet includes: and N pieces of related information of the first control instructions. The first instruction packet includes device IDs of N controlled terminals and their corresponding device types and command numbers, and its format is shown in table 2 below:
TABLE 2 first Command packet Format (two)
Figure 507026DEST_PATH_IMAGE002
Here, the sequence number is used to identify the sequence number of the first instruction packet generated by the server, and may be represented by 2 bytes, for example, 0011; the first LoRa gateway ID is used to identify the destination of the first instruction packet, and may be represented by 2 bytes, for example, 0022; the information related to the first control instruction includes a device ID, a device type, and a command number, which can be represented by 6 bytes, wherein the device ID is used to identify the controlled terminal, and can be represented by 4 bytes, for example, 33222222; the device type indicates the type of device to be controlled, for example, a meter is indicated by "00", and a lamp control is indicated by "01"; the command number is used for a specific control device, for example, for lamp control, turning off the lamp is indicated by "00" and turning on the lamp is indicated by "01".
Of course, the above is only an example of a first instruction packet format, and different fields and field lengths may be set to represent the first instruction packet according to the needs of the practical application.
Then, the first LoRa gateway generates N first control instructions that can be directly analyzed and/or executed for the controlled terminal, based on the device ID of the controlled terminal of each controlled terminal and the device type and command number corresponding thereto, respectively.
The format of the first control instruction may be as shown in table 3 below:
TABLE 3 first control instruction Format
Figure 601278DEST_PATH_IMAGE003
Here, the header is used to identify the start of the first control instruction, and may be represented by one byte, for example, fixedly adopting "BB"; the device ID is used to identify the controlled terminal and may be represented by 4 bytes, for example, 33222222; the device type indicates the type of device to be controlled, for example, a meter is indicated by "00", and a lamp control is indicated by "01"; the command number is used for a specific control device, for example, for lamp control, turning off the lamp is indicated by "00" and turning on the lamp is indicated by "01".
Of course, the above shows only one example of the format of the first control instruction, and different fields and field lengths may be set to represent the first control instruction according to the needs of the practical application.
In step S1022, the N first control commands are sequentially sent to the corresponding controlled terminals.
Here, the N first control instructions are sequentially sent to the corresponding controlled terminals based on the number of downlink channels of the first LoRa gateway.
Specifically, assuming that the number of downlink channels of the first LoRa gateway is P, where P is a positive integer smaller than N, then, first, P first control instructions may be sent simultaneously, and each first control instruction is sent on one downlink channel; and then, after receiving a first control response of a first control instruction returned by the controlled terminal, continuously sending the next first control instruction on the downlink channel.
In one embodiment, as shown in fig. 3, the method further comprises:
step S104: and within a first preset time threshold after the first control instruction is sent, if a first control response of the first control instruction returned by the controlled terminal is not received, the first control instruction is sent again.
Here, the setting of the first preset time threshold may refer to a round trip time period between the first LoRa gateway and the controlled terminal and a processing time period for the controlled terminal to process the first control instruction. For example, the first preset time threshold is set to 300 ms.
In this embodiment, the retransmitted first control instruction is further provided with a retransmission number flag for identifying that the current first control instruction is the first control instruction retransmitted several times.
In this embodiment, the first LoRa gateway retransmits the first control instruction if the first control response to the first control instruction returned by the controlled terminal is not received within a first preset time threshold after the first control instruction is transmitted, and stops transmitting the first control instruction if the first control response is not received after the first control instruction is retransmitted for a preset number of times.
In this embodiment, the first LoRa gateway directly retransmits the first control instruction to the controlled terminal, so that the retransmission delay is reduced and the control efficiency of the controlled terminal is improved, compared with the conventional retransmission at the server side.
In one embodiment, said resending said first control instruction comprises:
and when the retransmission condition of the first control instruction is met, retransmitting the first control instruction.
In one embodiment, the satisfying of the condition for retransmission of the first control instruction includes:
the retransmission times of the first control instruction are less than the preset times;
and/or the presence of a gas in the gas,
the first control instruction is sent within a first preset time threshold; wherein the second preset time threshold is greater than the first preset time threshold.
In this embodiment, on one hand, a first preset time threshold is introduced to control the response time of the first control instruction sent each time, so as to retransmit the first control instruction in time; on the other hand, the preset times are introduced to control the times of retransmitting the first control instruction, so that the transmission is ensured to be successful as much as possible, and unnecessary retransmission is avoided. Meanwhile, on the basis, a second preset time threshold is introduced to control the total time length of an allowed first control instruction so as to ensure the total sending time limit.
In one embodiment, as shown in fig. 3, the method further comprises:
step S105: a first control response of the first control instruction returned by the controlled terminal is not received within a first preset time threshold after the first control instruction is sent, and the receiving failure of the first control response corresponding to the first control instruction is determined if the retransmission condition of the first control instruction is not met;
step S106: and generating the first control response of the failed execution of the first control instruction.
In this embodiment, after the first LoRa gateway retransmits according to the preset parameters to the maximum extent, the first control response of the first control instruction returned by the controlled terminal is not received yet, that is, it is determined that the first control response of the corresponding first control instruction is failed to be received.
In step S106, since the first control response of the first control instruction returned by the controlled terminal is not received, the first control response in which the execution of the corresponding first control instruction fails is generated.
Meanwhile, in order to distinguish from a first control response in which the execution of the first control instruction returned by the controlled terminal fails, the first control response is further provided with an identification bit, and the identification bit is used for indicating that the first control response is generated by the first LoRa gateway or returned by the controlled terminal. Specifically, the format of the first control response may be as shown in table 4 below:
TABLE 4 format of first control response
Figure 324383DEST_PATH_IMAGE004
Here, the device ID is used to identify the controlled terminal, and may be represented by 4 bytes, for example, 33222222; the execution result flag is used to indicate the execution result of the first control instruction, and for example, the execution failure is indicated by "00", and the execution success is indicated by "01"; the flag bit is used to indicate that the first control response is generated by the first LoRa gateway or returned by the controlled terminal, for example, returned by the controlled terminal as "00" and generated by the first LoRa gateway as "01".
Of course, the above is only an example of a format of the first control response, and different fields and field lengths may be set to represent the first control response according to the needs of the practical application.
Accordingly, the format of the first response packet may be as shown in table 5 below:
table 5 first response packet format (one)
Figure 669914DEST_PATH_IMAGE005
Here, the sequence number is used to identify the sequence number of the first response packet generated by the first LoRa gateway, and may be represented by 2 bytes, for example, 0011; the first LoRa gateway ID, which is used to identify the originator of the first response packet, may be represented by 2 bytes, e.g., 0022; the first control response may be represented by 7 bytes including a device ID for identifying the controlled terminal, an execution result identification, and a flag bit, and may be represented by 4 bytes, for example, 33222222; the execution result flag is used to indicate the execution result of the first control instruction, and for example, the execution failure is indicated by "00", and the execution success is indicated by "01"; the flag bit is used to indicate that the first control response is generated by the first LoRa gateway or returned by the controlled terminal, for example, returned by the controlled terminal as "00" and generated by the first LoRa gateway as "01".
Of course, the above is only an example of a format of the first response packet, and different fields and field lengths may be set to represent the first response packet according to the needs of the practical application.
After receiving the first response packet, the server directly analyzes the first response packet to obtain N first control responses, and further determines the equipment ID of each first control response and the corresponding execution result identifier and flag bit thereof.
Alternatively, the format of the first response packet may be as shown in table 6 below:
table 6 first response packet format (two)
Figure 508688DEST_PATH_IMAGE006
Here, the sequence number is used to identify the sequence number of the first response packet generated by the first LoRa gateway, and may be represented by 2 bytes, for example, 0011; the first LoRa gateway ID, which is used to identify the originator of the first response packet, may be represented by 2 bytes, e.g., 0022; the device ID is used to identify the controlled terminal and may be represented by 4 bytes, for example, 33222222; the execution result flag is used to indicate the execution result of the first control instruction, and for example, the execution failure is indicated by "00", and the execution success is indicated by "01"; the flag bit is used to indicate that the first control response is generated by the first LoRa gateway or returned by the controlled terminal, for example, returned by the controlled terminal as "00" and generated by the first LoRa gateway as "01".
Of course, the above is only an example of a format of the first response packet, and different fields and field lengths may be set to represent the first response packet according to the needs of the practical application.
After receiving the first response packet, the server directly analyzes the first response packet to obtain the N equipment IDs and the corresponding execution result identifications and zone bits.
In one embodiment, as shown in fig. 3, the method further comprises:
step S108: receiving a second instruction packet sent by a server, wherein the second instruction packet comprises: and M second control instructions, one second control instruction, for controlling the controlled terminal in which the execution of the first control instruction fails, wherein M is the number of the first control instructions in which the execution fails.
In this embodiment, for a controlled terminal that fails to execute the first control instruction in the first instruction packet, the server regenerates the second instruction packet, and controls the corresponding controlled terminal through the second control instruction in the second instruction packet.
Here, the second control command may be the same as the first control command of the corresponding controlled terminal in the first command packet.
An embodiment of the present invention further provides a control method, applied to a server, as shown in fig. 4, including:
step S201: generating at least one first instruction packet, wherein one first instruction packet corresponds to a first LoRa gateway, and the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
step S202: respectively sending the first instruction packets to the corresponding first LoRa gateways;
step S203: receiving a first response packet of the first instruction packet returned by the first LoRa gateway, where the first response packet includes: n first control responses of the first control instruction.
In this embodiment, the first instruction packet includes: n first control instructions.
The first control instruction may include: device type, identity of controlled terminal and control indication information. Wherein the device types include: ammeter, lamp accuse etc. controlled terminal's sign can adopt controlled terminal's serial number, and control instruction information includes: opening, closing, opening after a preset time, closing after a preset time, opening at a fixed time, closing at a fixed time, periodically opening, periodically closing and the like. For example, a first control instruction includes: the device type is 01 (indicating lamp control), the controlled terminal is numbered 00000402, and the control instruction information is 00 (indicating off), then the first control instruction is used to control the controlled terminal numbered 11222222 to be off.
In one embodiment, as shown in fig. 5, the method further comprises:
step S204: generating a second instruction packet based on the first response packet, wherein the second instruction packet comprises: m second control instructions, one second control instruction, for controlling the controlled terminal that the first control instruction fails to execute, wherein M is the number of the first control instructions that fail to execute;
in this embodiment, based on the first response packet, the server regenerates the second instruction packet for the controlled terminal that failed to execute the first control instruction in the first instruction packet, and controls the corresponding controlled terminal through the second control instruction in the second instruction packet.
Here, the second control command may be the same as the first control command of the corresponding controlled terminal in the first command packet.
Step S205: and sending the second instruction packet to a first LoRa gateway corresponding to the first response packet.
An embodiment of the present invention further provides a control device, which is applied to a first LoRa gateway, and as shown in fig. 6, the control device includes:
a first receiving unit 101, configured to receive a first instruction packet sent by a server, where the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
a first sending unit 102, configured to send the first control instruction to the corresponding controlled terminals respectively based on the first instruction packet;
a second receiving unit 103, configured to receive a first control response of the first control instruction returned by the controlled terminal;
a second sending unit 104, configured to carry the first control responses of the N first control instructions in the same first response packet and return the first control responses to the server.
In one embodiment, the first sending unit 102 includes:
the splitting module is used for splitting the first instruction packet to obtain the N first control instructions;
and the sending module is used for sequentially sending the N first control instructions to the corresponding controlled terminals.
In one embodiment, the control device further comprises:
and the retransmitting unit is used for retransmitting the first control instruction if a first control response of the first control instruction returned by the controlled terminal is not received within a first preset time threshold after the first control instruction is sent.
In an embodiment, the retransmission unit is specifically configured to retransmit the first control instruction when a retransmission condition of the first control instruction is satisfied.
In one embodiment, the control device further comprises:
a determining unit, configured to determine that a first control response corresponding to the first control instruction is failed to be received, where the first control response of the first control instruction returned by the controlled terminal is not received within a first preset time threshold after the first control instruction is sent, and a retransmission condition of the first control instruction is not satisfied;
a generating unit, configured to generate the first control response in which the first control instruction fails to be executed.
In an embodiment, the first receiving unit 101 is further configured to receive a second instruction packet sent by the server, where the second instruction packet includes: and M second control instructions, one second control instruction, for controlling the controlled terminal in which the execution of the first control instruction fails, wherein M is the number of the first control instructions in which the execution fails.
An embodiment of the present invention further provides a control device, applied to a server, as shown in fig. 7, including:
a generating unit 201, configured to generate at least one first instruction packet, where one of the first instruction packets corresponds to a first LoRa gateway, and the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
a sending unit 202, configured to send the first instruction packets to the corresponding first LoRa gateways respectively;
a receiving unit 203, configured to receive a first response packet of the first instruction packet returned by the first LoRa gateway, where the first response packet includes: n first control responses of the first control instruction.
In one embodiment, the generating unit 201 is further configured to generate a second instruction packet based on the first response packet, where the second instruction packet includes: m second control instructions, one second control instruction, for controlling the controlled terminal that the first control instruction fails to execute, wherein M is the number of the first control instructions that fail to execute;
the sending unit 202 is further configured to send the second instruction packet to the first LoRa gateway corresponding to the first response packet.
Several specific examples are provided below in connection with any of the above embodiments:
in the prior art, a conventional LoRaWAN network architecture is shown in fig. 8, and includes an End node (LoRaWAN terminal), a LoRaWAN gateway, an NS (network server), and an application server, where networking between the LoRaWAN terminal and the LoRaWAN gateway is a star topology. The RF mainstream chip of the LoRaWAN terminal adopts SX1278 and is used for carrying out wireless communication with the LoRaWAN gateway; the LoRaWAN generally adopts a gateway with an SX1301 chip, and has high price, large node capacity and long transmission distance; the NS (network server) adopts a mainstream mode to transmit the LoRaWAN gateway, the LoRaWAN server is deployed by the network server, and all the network access, data analysis and data transmission are processed by the network server; the application server is mainly used for equipment management, data collection, forwarding and analysis and the like.
Based on the LoRaWAN network architecture, the server sequentially controls each LoRaWAN terminal through the LoRaWAN gateway, and in one round of control of the server on all LoRaWAN terminals, long time is needed, and experience is poor.
Specifically, the following was analyzed as an example:
the node capacity of the LoRaWAN gateway is calculated according to the following formula:
Figure 103617DEST_PATH_IMAGE007
wherein the content of the first and second substances,
Figure 833676DEST_PATH_IMAGE008
for channel capacity (i.e., number of nodes), 8 represents 8 channels,
Figure 17401DEST_PATH_IMAGE009
representing the transmission interval, in relation to the packet length and rate,
Figure 541924DEST_PATH_IMAGE010
is the basic Aloha algorithm maximum throughput,
Figure 827411DEST_PATH_IMAGE011
is a constant (equal to 2.718),
Figure 643052DEST_PATH_IMAGE012
represents the time of broadcast, ToA (time on air), of a single packet.
Under the condition of 10-byte load, the relationship between the data rate and the broadcasting time ToA is shown in the following table 7:
TABLE 7 data Rate versus airtime ToA
Figure 697596DEST_PATH_IMAGE014
In case of using SX1301 chip, without LBT (listen before packet channel), and average per packet air time of flight
Figure 393019DEST_PATH_IMAGE015
(accordingly)
Figure 165803DEST_PATH_IMAGE016
) On average, once a minute per packet (hence
Figure 743722DEST_PATH_IMAGE017
) Then, the process of the present invention,
Figure 918351DEST_PATH_IMAGE018
therefore, 883 nodes can be accommodated.
Moreover, using different algorithms also results in a change in the maximum throughput, leading to a change in the theoretical capacity.
For example, if the precondition is modified to make each node have LBT function and the slotted Aloha algorithm is adopted instead of the basic Aloha algorithm to evaluate, the maximum throughput is different due to different algorithms, and the maximum throughput is the maximum throughput at this time
Figure 784676DEST_PATH_IMAGE019
And therefore channel capacity (i.e., number of nodes)
Figure 326647DEST_PATH_IMAGE020
Thus, then manageThe theoretical capacity is doubled, i.e. 883 x 2=1766 nodes.
In the using process of the project, in order to save cost, one LoRaWAN terminal is only provided with one LoRaWAN gateway with good signal coverage. Through the theoretical calculation, a packet of data is reported in 15 minutes, and under the condition of good signals, one LoRaWAN gateway is expected to carry more than 10000 nodes.
If one LoRaWAN gateway covers 1000 lamp controllers, a lamp-off instruction is sent to all the lamp controllers through a platform (server). Because the SX1301LoRaWAN gateway only has one downlink channel at present, the realization mode has two types:
the server sends a light-off instruction to the first device, controls the light-off, returns a successful packet to the server, continues to send the instruction to the second light-control after receiving the successful return packet, continues to send the light-off instruction to the first light-control until receiving the return packet if not receiving the successful packet, then sends the light-off instruction to the second light-control, and so on;
and in the second mode, the platform sends the light-off instructions of 1000 devices in sequence, then sends the light-off instructions again to the light control which does not receive the return packet, and so on.
In the two ways, if the server issues the data and the data returned by the LoRaWAN terminal have no packet loss,
Figure 936620DEST_PATH_IMAGE021
lamp-controlled action and processing time
Figure 746182DEST_PATH_IMAGE022
Then, it probably takes time to complete 1000 lamp control turn-off
Figure 48987DEST_PATH_IMAGE023
If according to the limit value
Figure 327522DEST_PATH_IMAGE024
Figure 491918DEST_PATH_IMAGE025
And one turn of 1000 lamp-controlled lamp turn-off is completed, which probably needs 5 min to 60min, consumes long time and has poor experience of lamp turn-off.
As shown in fig. 9, the LoRaWAN network architecture includes LoRaWAN terminals, an edge gateway (corresponding to a first gateway), an LoRaWAN gateway (corresponding to a second gateway), an NS (network server), and an application server. The LoRaWAN gateway, the NS (network server) and the application server are standard LoRaWAN products, the edge gateway and the LoRaWAN gateway communicate through a standard LoRaWAN protocol, and the LoRaWAN terminal and the edge gateway communicate through a private LoRa protocol. An edge gateway is additionally arranged between the LoRaWAN gateway and the LoRaWAN terminal, and part of computation repetition mechanisms are put on the edge gateway to be realized, so that the computation resources of the server are saved, and the time for issuing control by the server is greatly shortened.
Based on the LoRaWAN network architecture shown in fig. 9, similarly, 1000 light controls are covered for one LoRaWAN gateway, and in a scenario where a light-off instruction is issued to all the light controls through a platform (server), the server issues instruction packets to 10 edge gateways, and the 10 edge gateways control corresponding LoRaWAN terminals based on the instruction packets, so that theoretically, more than 10 times of instructions can be saved, and compromise can be made between control delay and equipment cost.
Specifically, a proprietary loran protocol is used for communication between the loran terminal and the edge gateway, where the loran terminal communication protocol is shown in table 8 below:
table 8 LoRaWAN terminal communication protocol
Figure 109981DEST_PATH_IMAGE027
The edge gateway adopts an SX1278 chip, the data throughput of the chip is about 1/18 of SX1301, the cost of the single chip is about 1/30 of SX1301, and the edge gateway is low in cost and is suitable for the scene.
The frame diagram of the edge gateway is shown in fig. 10, and includes a control unit (MCU), a first LoRa communication module and a second LoRa communication module, where the first LoRa communication module is used for standard LoRaWAN communication with the LoRaWAN gateway; the second LoRa communication module is used for communicating with the LoRaWAN terminal by using the communication protocol shown in table 8. Here, the SX1278 chip is used for both the first LoRa communication module and the second LoRa communication module.
During operation, the server sends down the instruction package including a plurality of control command for the edge gateway through LoRaWAN gateway, and MCU receives control command through first LoRa communication module, sends down control command to the LoRa terminal through second LoRa communication module, and the edge gateway receives the control response that the LoRa terminal returned and just calculates control execution success to continue to send down next control command. And after receiving the control response of each LoRa terminal, the edge gateway forms a response packet and replies to the server through the LoRaWAN gateway.
The embodiment of the invention also provides a computer storage medium, and the computer storage medium stores computer executable instructions; after the computer executable instruction is executed by the processor, the expression information selection method provided by one or more technical schemes can be realized.
The computer storage medium may be: a storage medium such as a removable storage device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes may be selected as a non-transitory storage medium.
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. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some ports, indirect coupling or communication connection between devices or units, and may be electrical, mechanical or other.
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, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may be separately used as one unit, or two or more units may be 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.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (12)

1. A control method is applied to a first LoRa gateway and comprises the following steps:
receiving a first instruction packet sent by a server, wherein the first instruction packet comprises: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
respectively sending the first control instruction to the corresponding controlled terminals based on the first instruction packet;
receiving a first control response of the first control instruction returned by the controlled terminal;
and returning the N first control responses of the first control instruction to the server by carrying the N first control responses in the same first response packet.
2. The method according to claim 1, wherein the sending the first control commands to the corresponding controlled terminals respectively based on the first command packet comprises:
splitting the first instruction packet to obtain the N first control instructions;
and sequentially sending the N first control instructions to the corresponding controlled terminals.
3. The method of claim 1, further comprising: and within a first preset time threshold after the first control instruction is sent, if a first control response of the first control instruction returned by the controlled terminal is not received, the first control instruction is sent again.
4. The method of claim 3, wherein said resending the first control instruction comprises:
and when the retransmission condition of the first control instruction is met, retransmitting the first control instruction.
5. The method of claim 4, wherein satisfying the condition for resending the first control instruction comprises:
the retransmission times of the first control instruction are less than the preset times;
and/or the presence of a gas in the gas,
the first control instruction is sent within a first preset time threshold; wherein the second preset time threshold is greater than the first preset time threshold.
6. The method according to any one of claims 3 to 5, further comprising:
a first control response of the first control instruction returned by the controlled terminal is not received within a first preset time threshold after the first control instruction is sent, and the receiving failure of the first control response corresponding to the first control instruction is determined if the retransmission condition of the first control instruction is not met;
and generating the first control response of the failed execution of the first control instruction.
7. The method of claim 6, further comprising:
receiving a second instruction packet sent by a server, wherein the second instruction packet comprises: and M second control instructions, one second control instruction, for controlling the controlled terminal in which the execution of the first control instruction fails, wherein M is the number of the first control instructions in which the execution fails.
8. A control method is applied to a server and comprises the following steps:
generating at least one first instruction packet, wherein one first instruction packet corresponds to a first LoRa gateway, and the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
respectively sending the first instruction packets to the corresponding first LoRa gateways;
receiving a first response packet of the first instruction packet returned by the first LoRa gateway, where the first response packet includes: n first control responses of the first control instruction.
9. The method of claim 8, further comprising:
generating a second instruction packet based on the first response packet, wherein the second instruction packet comprises: m second control instructions, one second control instruction, for controlling the controlled terminal that the first control instruction fails to execute, wherein M is the number of the first control instructions that fail to execute;
and sending the second instruction packet to a first LoRa gateway corresponding to the first response packet.
10. A control device, which is applied to a first LoRa gateway, includes:
a first receiving unit, configured to receive a first instruction packet sent by a server, where the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
a first sending unit, configured to send the first control instruction to the corresponding controlled terminals respectively based on the first instruction packet;
a second receiving unit, configured to receive a first control response of the first control instruction returned by the controlled terminal;
and the second sending unit is used for returning the first control responses of the N first control instructions carried in the same first response packet to the server.
11. A control device, applied to a server, includes:
a generating unit, configured to generate at least one first instruction packet, where one of the first instruction packets corresponds to a first LoRa gateway, and the first instruction packet includes: the first control instructions are used for controlling a controlled terminal connected with the first LoRa gateway; wherein N is a positive integer greater than or equal to 2;
the sending unit is used for respectively sending the first instruction packets to the corresponding first LoRa gateways;
a receiving unit, configured to receive a first response packet of the first instruction packet returned by the first LoRa gateway, where the first response packet includes: n first control responses of the first control instruction.
12. A computer storage medium storing a computer program capable of implementing the method provided in any one of claims 1 to 7 or 8 to 9 when executed.
CN202110035774.8A 2021-01-12 2021-01-12 Control method, control device and computer storage medium Pending CN112367407A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110035774.8A CN112367407A (en) 2021-01-12 2021-01-12 Control method, control device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110035774.8A CN112367407A (en) 2021-01-12 2021-01-12 Control method, control device and computer storage medium

Publications (1)

Publication Number Publication Date
CN112367407A true CN112367407A (en) 2021-02-12

Family

ID=74534822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110035774.8A Pending CN112367407A (en) 2021-01-12 2021-01-12 Control method, control device and computer storage medium

Country Status (1)

Country Link
CN (1) CN112367407A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506619A (en) * 2016-10-31 2017-03-15 成都加华科技有限责任公司 A kind of things-internet gateway and its control method
CN109357706A (en) * 2018-10-10 2019-02-19 山东理工大学 A kind of intelligent radio greenhouse monitoring system based on Internet of Things
CN110087375A (en) * 2019-05-17 2019-08-02 厦门光莆电子股份有限公司 A kind of lighting control system and its illumination control method based on LoRa
CN110312273A (en) * 2019-07-30 2019-10-08 武汉慧联无限科技有限公司 A kind of LoRa gateway and its method for remote management
US10623240B2 (en) * 2016-08-25 2020-04-14 Intel Corporation IoT solution sizing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10623240B2 (en) * 2016-08-25 2020-04-14 Intel Corporation IoT solution sizing
CN106506619A (en) * 2016-10-31 2017-03-15 成都加华科技有限责任公司 A kind of things-internet gateway and its control method
CN109357706A (en) * 2018-10-10 2019-02-19 山东理工大学 A kind of intelligent radio greenhouse monitoring system based on Internet of Things
CN110087375A (en) * 2019-05-17 2019-08-02 厦门光莆电子股份有限公司 A kind of lighting control system and its illumination control method based on LoRa
CN110312273A (en) * 2019-07-30 2019-10-08 武汉慧联无限科技有限公司 A kind of LoRa gateway and its method for remote management

Similar Documents

Publication Publication Date Title
US8098615B2 (en) Network protocol
CN100502357C (en) Wireless communication system for multicast communications and related method fo wireless LAN system
CN105357746B (en) Double bounce wireless network architecture
KR20220140709A (en) Method and device for sidelink communication
JP2004328749A (en) Apparatus and method for data packet retransmission in mobile ad hoc network environment
CN114982355A (en) Method and apparatus for sidelink communications
Dwijaksara et al. Multihop gateway-to-gateway communication protocol for lora networks
US11647431B2 (en) Heterogeneous networks using two channel hopping protocols
CN110708763A (en) Scheduling method, device and computer storage medium
KR100770073B1 (en) Method and Apparatus for Efficient Data Broadcast Within Beaconing Network
CN115696254A (en) Big data transmission method of wireless sensor network
JP6432294B2 (en) COMMUNICATION SYSTEM, COMMUNICATION SYSTEM CONTROL METHOD, AND PROGRAM
US10680899B1 (en) Topology discovery through multicast transmission
CN108650688A (en) A kind of method and Lora gateways of sweep check
CN112396814B (en) Alarm topology transmission method and related product
CN112367407A (en) Control method, control device and computer storage medium
CN110381563A (en) A kind of uplink resources allocation strategy of self-organizing relay forwarding network
CN114727427A (en) Method for realizing MESH of LoRa gateway
CN117242747A (en) Time-divided physical layer access for network communications
Mavromatis et al. Reliable IoT Firmware Updates: A Large-scale Mesh Network Performance Investigation
CN108650686A (en) A kind of Ping-Pong test methods, terminal and the server of frequency sweep
Panga et al. Leveraging Wake-Up Radios in UAV-Aided LoRa Networks: Some Preliminary Results on a Random-Access Scheme
CN110839213B (en) Broadcasting method and system
CN113258958B (en) Power line carrier communication method based on OFDM and communication node
Tang et al. The networking performance analysis of wireless broadband communication in electricity system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210212