A method for constructing a wireless sensor network protocol carrying modbus over wifi
By adopting WiFi as a carrier of the Modbus protocol in wireless sensor networks, redefining the timing and MAC frame format, and optimizing the data frame capacity and node interaction process, the communication complexity and packet loss problems in the monitoring of large industrial equipment are solved, and efficient data transmission and equipment management are achieved.
Patent Information
- Application Number
- CN202310807200.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-04
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-07-04
AI Technical Summary
Existing wireless sensor network protocols have failed to effectively address the complex and ever-changing communication scenarios, varying network coverage, data transmission timeliness, and packet loss issues in large-scale industrial settings, thus failing to meet the monitoring needs of large and complex industrial equipment.
The Modbus protocol is carried by WiFi. The timing and MAC frame format are redefined, the data frame capacity is optimized, the distributed node interaction process is designed by simplifying the data frame and embedding Modbus frames, the data transmission protocol and encapsulation format are optimized, and the Modbus data is carried by WiFi protocol.
It improves data transmission efficiency, reduces packet loss and bit errors, extends node lifespan, simplifies node interaction processes, and enhances the management level of monitoring large industrial equipment.
Smart Images

Figure CN116684502B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of information automation, and specifically relates to a WiFi bearing Modbus wireless sensor network protocol construction method, and relates to a new distributed equipment monitoring system suitable for large and complex industrial equipment monitoring scenes, which comprises a node interaction process, a state data wireless networking, a transmission protocol, data encapsulation and analysis, etc. BACKGROUND
[0002] With the rapid development of modern measurement and information technology, the operation and management of traditional industries are comprehensively improved towards informatization and intelligentization. In large industrial scenes such as large hydropower stations, the area is large, the equipment types are various, and the traditional monitoring method is easy to cause problems such as complex construction and wiring, so it is urgent to improve the monitoring and management level of power station equipment. Wireless sensor network (WSN) integrates distributed information processing technology, has the advantages of multiple monitoring, comprehensive data, flexible networking, and friendly interaction, can simplify the measurement equipment and communication network, save construction materials and labor cost, and is an advantageous technology to improve the level of equipment monitoring and management.
[0003] However, in the existing communication protocol design, the communication scene is complex and variable, the network coverage is different, and different application scenes are not considered to be designed specifically, and a set of protocols cannot completely deal with all scenes. On the other hand, most of the current designs consider the transmission of a large amount of data, and ignore the timeliness, packet loss and other influences. If a distributed, wireless ad hoc network key auxiliary equipment online monitoring system communication protocol suitable for large industrial scenes can be designed, the efficiency of data transmission can be further improved, and the packet loss and error code conditions can be reduced.
[0004] The prior art is as follows:
[0005] Compared with the patent CN107920051A "a wireless sensor network protocol construction method in the Internet", the differences are as follows:
[0006] 1. The wireless sensor network protocol in the patent CN107920051A is based on IEEE802.15.4, and we use IEEE802.11b protocol.
[0007] 2. In the patent CN107920051A, the way to expand the payload is to realize the compression of the IPv6 message header, and we use the simplified WiFi frame header and frame tail to achieve the purpose of expanding the payload.
[0008] Compared with the patent CN103068071A "construction method of biased low-cost spanning tree in wireless sensor network", the differences are as follows:
[0009] 1. Unlike patent CN103068071A, which prioritizes rechargeable nodes to form a biased low-cost spanning tree in wireless sensor networks to minimize the workload of non-rechargeable nodes and reduce their energy consumption, thereby extending the network lifetime, our approach reduces the interaction processes between nodes and improves node response speed, thereby reducing node energy consumption and extending node lifespan.
[0010] 2. While patent CN103068071A uses a biased low-cost spanning tree calculation method for the node paths of wireless sensor networks, we directly use the path generation algorithm built into the WiFi router.
[0011] 3. Patent CN103068071A did not improve the data packet encapsulation format, nor did it change the node interaction method.
[0012] The differences between this patent and the one in patent CN103037468A, “Method for Constructing Biased Shortest Path Spanning Tree in Wireless Sensor Networks”, are as follows:
[0013] 1. Unlike the biased shortest path spanning tree algorithm used in patent CN103037468A for wireless sensor networks, which prioritizes nodes that can add more new nodes to the spanning tree under the condition of equal node types, thereby minimizing the workload of non-rechargeable nodes and reducing their energy consumption to extend the network lifetime, our approach reduces the interaction process between nodes and improves the response speed of nodes, thereby reducing node energy consumption and increasing node lifespan.
[0014] 2. Patent CN103037468A uses a biased low-cost spanning tree calculation method for the node path of the wireless sensor network, while we directly use the path generation algorithm built into the WiFi router.
[0015] 3. Patent CN103037468A did not improve the data packet encapsulation format, nor did it change the node interaction method. Summary of the Invention
[0016] To address the aforementioned technical issues, this invention proposes a method for constructing a wireless sensor network protocol that carries Modbus over WiFi. This method includes node interaction procedures, wireless networking of status data, transmission protocols, data encapsulation and parsing, and corrects current issues such as packet loss and congestion.
[0017] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0018] A method for constructing a WiFi-based Modbus wireless sensor network protocol includes the following steps:
[0019] WiFi carries Modbus protocol;
[0020] Re-defining the timing of WiFi;
[0021] Wireless networking and data transmission process;
[0022] Optimizing the MAC frame format of WiFi, assigning more fields to PayloadType, and embedding Modbus protocol in WiFi protocol to fully expand the capacity of WiFi data frame.
[0023] As a further improvement of the application, the step 1) comprises;
[0024] 1.1) Protocol process design;
[0025] Developing the protocol of MAC layer, which defines the transmission and encapsulation format of data in the network, and restricts the access and use of the channel, wherein the WSN adopts a distributed network with multiple nodes working collaboratively, and the protocol of MAC layer follows a distributed structure;
[0026] Defining the message type and node state of MAC protocol process;
[0027] For any group of nodes, assuming that node A is the source node and node B is the sink node;
[0028] 1.2) Data frame design;
[0029] For the encapsulation format of MAC data frame, the original data frame is first simplified, and the redundant bytes are allocated to the data content field, then the Modbus frame is embedded in the WiFi data frame, and WiFi protocol is used to carry Modbus protocol.
[0030] As a further improvement of the application, the message type and node state of the MAC protocol process in step 1.1) are defined as follows:
[0031] Including message type and node type.
[0032] As a further improvement of the application, the message type comprises; RS means that the source node is ready to send data and detects whether the channel is idle; CS means that the sink node replies to the RS message after receiving it, indicating that the current channel is idle and can receive data; ACK means that the sink node responds to the successful and accurate reception of data; DA means waiting to send data.
[0033] As a further improvement of the application, the protocol process of the node in step 1.1) is as follows:
[0034] Step1.Assume that a data collection sensor in the network is node A, and the network coordinator is node B. When the two nodes have no data to transmit and receive, they are in a static state Q.
[0035] Step2.Node A needs to send data to node B. A sends an RS (1011) message to B, indicating that it currently has a set of data to send, and probes whether the channel is idle. At this time, A jumps from the Q state to the WCS state.
[0036] Step3.After B receives the RS message sent by A, it first judges whether the message destination address is correct. If the address is correct, B sends a CS 1100 message to A, indicating that the current channel is idle and data can be sent to itself. At this time, B jumps from the Q state to the WDA state.
[0037] Step4.After A receives the CS message returned by B, it indicates that data transmission can be performed. A encapsulates the data into a data packet, indicates DA 0000 message in the frame control bit, and sends it to node B after encapsulation. At this time, A jumps from the WCS state to the WACK state.
[0038] Step5.After B receives the DA message, it performs FCS check on the data. If the check is incorrect, the data is discarded and an error message is fed back to the upper computer. If the check is correct, the data is received and an ACK 1101 message is returned to A.
[0039] Step6.After A successfully receives the ACK message, it indicates that the data transmission is completed, and A and B jump back to the Q state and wait for the next data transmission.
[0040] As a further improvement of the application, the step 1.2) utilizes the WiFi protocol to carry the Modbus protocol, and the data frame format after modification is as follows:
[0041] The step 1.2) utilizes the WiFi protocol to carry the Modbus protocol, and the data frame format after modification is as follows:
[0042] (1) Frame control bit: 2 bytes, used to indicate four kinds of message types: RS, CS, ACK, DA, and the codes are: 1011, 1100, 1101, 0000;
[0043] (2) Duration / ID bit: 2 bytes, used for NAV setting of the WiFi data frame;
[0044] (3) Destination address bit: 6 bytes, used to indicate the location of the sink node;
[0045] (4) Source address bit: 6 bytes, used to indicate the location of the source node;
[0046] (5) Time interval: 4 bytes, since the Modbus data frame has no start and end symbols, it is stipulated that there is a 4-character pause interval between two Modbus frames, which is used to indicate the start of the Modbus frame;
[0047] (6) Modbus data frame: 256 bytes, the Modbus frame is embedded into the data content field of WiFi, and the encapsulation format is as follows: the encapsulation fields are as follows:
[0048] (6.1) Device address bit: 1 byte, used to indicate the initiator of the message, the value is the sending node ID, numbered according to the industrial site partition, defined from 0x01 to 0xff;
[0049] (6.2) Function code: 1 byte, used to indicate the message destination, the value is the target node ID, defined according to the main task of the node, according to the application scene, only the first five function codes need to be defined as follows: 01 indicates reading coil status, 02 indicates reading input status, 03 indicates reading holding register, 04 indicates reading input register, and 05 indicates forced coil;
[0050] (6.3) Instruction segment length: 2 bytes, used to indicate the length of the Modbus data frame, which can achieve the purpose of reducing the checking step;
[0051] (6.4) Modbus instruction segment: 246 bytes, used to indicate the actual data content or instruction message;
[0052] (6.5) CRC check code: 2 bytes, used to check whether the Modbus data frame is correct;
[0053] (7) FCS check code bit: 2 bytes, used to check whether the WiFi data frame is correct;
[0054] (8) Four-byte interval, the second Modbus frame is 256 bytes, four-byte interval, the third Modbus frame is 256 bytes, four-byte interval, the fourth Modbus frame is 256 bytes, four-byte interval, the fifth Modbus frame is 256 bytes, Nul and FCS check code bit is 2 bytes.
[0055] As a further improvement of the application, the step 1.2) is that one WiFi data frame has at most 1500 bytes, one Modbus frame has at most 256 bytes, so one WiFi data packet embeds five Modbus data packets, one WiFi data frame can transmit five Modbus frames at a time, when the data is transmitted in the WSN network, the message type is simplified, the frame control bit has only four codes, which is more convenient to identify, the Duration / ID bit, the destination address, the source address and the FCS check code all use the original WiFi format;
[0056] The device address of Modbus is set according to the number of workshops, under the system, only the first five function codes are enough to indicate all instructions, so the numbers after 05 are not defined;
[0057] Since the Modbus data frame has no start and end symbols, it is stipulated that there is a pause interval of four characters between two Modbus frames, if a new Modbus frame is sent in less than the time interval, the receiving device will consider it as a continuation of the previous frame, which will cause CRC check error and data receiving failure.
[0058] As a further improvement of the application, the step 1.2) is that the data transmission in the system is in a transparent mode, the WiFi device does not modify and process the embedded Modbus data packet, and the Modbus instruction does not affect the transmission structure of WiFi.
[0059] As a further improvement of the application, the step 2) wireless network construction and data transmission process is divided into four modules: WiFi network initialization, node joining network, Modbus framing and data transmission.
[0060] As a further improvement of the application, the WiFi network initialization process is as follows:
[0061] First, confirm a full-function node, then send a beacon request command outwardly, and set a scanning period T, if no beacon is detected within the scanning period, it is determined that the node is the coordinator of the network, and the network identifier is selected;
[0062] The node joining network process is as follows:
[0063] The premise of data transmission in the network is that the node scans the nearby coordinator and sends a network access request, the coordinator receives the request and decides whether to agree to connect according to the situation;
[0064] The Modbus execution process is as follows:
[0065] First, initialize the serial port, then test, if the test is correct, send the instruction to the slave, the node executes the instruction and feeds back the result to the host.
[0066] The data transmission process is as follows:
[0067] The data is encapsulated and then transmitted according to the data link.
[0068] The application is a method suitable for large industrial scene equipment state monitoring, using a WiFi protocol to carry a Modbus protocol: first, the message type and node state of the protocol are defined, then the encapsulation format of the data is designed, the new protocol is used for large hydropower station equipment monitoring, different frequency domain bandwidths are selected according to the test situation, and finally the TTL of the protocol is adjusted according to the specific requirements of the hydropower station on the monitoring data. BRIEF DESCRIPTION OF DRAWINGS
[0069] Figure 1 is a protocol flowchart of the medium access sublayer of the data link layer of the communication protocol;
[0070] Figure 2 is a schematic diagram of embedding the modbus protocol into the WiFi protocol;
[0071] Figure 3 is a communication protocol networking and data acquisition flowchart of a wireless sensor network;
[0072] Figure 4 is a framework module of an online monitoring system of the application applied to large hydropower station key auxiliary equipment;
[0073] Figure 5 is the effect of different frequency domain effective bandwidths on data transmission under the condition that the communication frequency band is set to 2.4GHz and there is no external source data channel occupation, the TTL (Time-To-Live) is set to 1s;
[0074] Figure 6 is the system data transmission performance under different channel numbers under the selected frequency domain bandwidth. DETAILED DESCRIPTION
[0075] The application will be further described in detail below in combination with the drawings and specific embodiments:
[0076] EMBODIMENT
[0077] In this embodiment, the attached Figure 1The large-scale hydropower station monitoring application system test and verification is shown. The system has four monitoring areas, and sensors are deployed in the monitoring equipment and areas to periodically collect real-time state information such as vibration, temperature, electrical working conditions and the like. The node encapsulates the collected data and sends it to the coordinator through the WiFi wireless network, and sends it to the upper computer via the RS-485 bus. The upper computer transmits the data to the online monitoring system through Ethernet, which is analyzed by the monitoring personnel, and the data is sent into the local area network to realize multi-user data sharing in the network. The monitoring personnel can also issue instructions to the node to retrieve real-time state data.
[0078] The data transmission of the hydropower station monitoring system adopts a multi-hop routing mode, and it is difficult to directly use the existing WiFi protocol process and encapsulation format, and packet loss, congestion and other conditions may occur during the jump process. The core of the WiFi data link layer is the protocol specification of the Medium Access Control (MAC) layer, which defines the transmission and encapsulation format of data in the network and restricts the access and use of the channel, so the protocol process and encapsulation format of the MAC layer directly determine the communication performance of the network. Since the wireless sensor network of the system is a distributed network with multiple nodes working together, the MAC layer protocol must also follow a distributed structure. First, the message type and node state of the MAC protocol process are defined, as described in the invention. The redefined protocol process is shown in the accompanying drawings Figure 1 As shown: Step 1. When A and B have not received any command, they are in Q state; Step 2. When A sends RS message to B, A changes from Q state to WCS; B judges whether the message destination address is itself, if the address is correct, B jumps from Q state to WDA, and sends CS message to A indicating that the channel is available; Step 3. If A receives the CS message sent by B, it indicates that the current channel is idle and data transmission can be performed; Step 4. When A sends DA to B, A jumps to WACK state; B checks the data, if the data is correct, B returns ACK message to A; Step 5. When A receives the ACK message returned by B, it indicates that this data transmission is completed, A and B return to Q state, and wait for the next data transmission.
[0079] For the encapsulation format of the MAC data frame, the original data frame is first simplified, the redundant bytes are allocated to the data content field, and the Modbus frame is embedded in the WiFi data frame, and the WiFi protocol is used to carry the Modbus protocol.
[0080] In Figure 2In the encapsulation format, a WiFi data frame has at most 1500 bytes, and a Modbus frame has at most 256 bytes, so a WiFi data packet can embed 5 Modbus data packets, and a WiFi frame can transmit 5 Modbus frames at a time. When data is transmitted in the system network, the number of message frames is greatly reduced, and the probability of congestion is reduced. After simplifying the message type, the frame control bit of the data frame has only four codes, which is more convenient to identify. The Duration / ID bit, destination address, source address and FCS check code all use the original WiFi format.
[0081] To realize wireless data acquisition of dispersed measuring points, the networking process also needs to be standardized. The network establishment and data transmission process is shown in FIG. 2. Figure 3 As shown in FIG. 2, the process mainly includes four modules: WiFi network initialization, node joining network, Modbus framing and data transmission.
[0082] The WiFi network initialization first judges whether the node is a full function node (Full Function Device, FFD). If the node meets the conditions, the network sends a beacon request command and sets a scanning period T. If no beacon is detected within the scanning period, it is considered that the FFD is not a coordinator of other networks, and it is determined as the coordinator of this network. At this time, the WiFi network can be established, the beacon can be generated and broadcasted. Then the channel is scanned. If the energy of the channel does not meet the standard, the channel is discarded and other channels are selected. After finding a suitable channel, a network identifier is selected for the network. After the above steps, the WiFi network is successfully initialized.
[0083] The main steps of node joining network include: the node actively scans the nearby coordinator, and sends a network access request if a coordinator is detected. The coordinator receives the connection request of the node and decides whether to allow the connection according to the situation, and then responds to the node requesting connection. The node joining the network is the premise of data transmission in the network. After the node successfully joins the network, the coordinator will assign an address to the node.
[0084] Modbus execution process: first, the serial port is initialized, the initialization content includes selecting the transmission mode, setting the slave address and configuring the serial port, the data transmission protocol of this system stipulates that there is only one host on the bus, and there can be multiple slaves, each slave device is set with a unique network address in the network initialization stage. After initialization, the communication is tested, and after the test is correct, the slave is sent to the master; the slave device receiving the command will verify the CRC check code, and if the check is correct, the information of the command can be parsed and executed, and the execution result is fed back to the host, if the check is wrong, the data is discarded and the error information is fed back to the host.
[0085] After the network is built, data collection can be performed, sent to the WiFi node, and the node is sent to the host computer via RS-485 line. Finally, the user can analyze and forward the data online to realize real-time monitoring of key auxiliary equipment, as shown in Figure 4 .
[0086] The above communication protocol is used for testing in large hydropower stations. Wireless communication feasibility test selects 10 dispersed auxiliary machine state data, 1000 groups of data per test point, a total of 10000 groups of data. In the case where all channels (14) of the system WiFi are used for this task and there is no external data channel occupation, set TTL (Time-To-Live) to 1s, the effect of different frequency domain effective bandwidth on data transmission is shown in Figure 5 . According to the results in Figure 5 , select the appropriate frequency domain effective bandwidth for the application scenario to ensure data integrity.
[0087] Consider that there are many wireless data systems sharing channels in the wireless network environment where the application system is located. When transmitting data, channel occupation often occurs. Under the condition of the selected bandwidth, 10x1000 groups of vibration data from dispersed sources are collected and transmitted. When the number of channels is different under the load competition condition, the performance test results of the system wireless data transmission are shown in Figure 6 .
[0088] The test results show that: with the increase of data load in the effective bandwidth, the number of available channels for data transmission of this system decreases, the average network delay and packet loss rate increase significantly, and when the packet loss rate exceeds 25‰, the system cannot work normally. Under the original TTL threshold value of 1s, to solve the problem of high packet loss rate, the TTL extension setting strategy is adopted, and when the timeout threshold packet loss occurs in data transmission, the TTL setting value is extended by 500ms time slice interval. From Figure 6The test results show that when the number of available channels is large, the packet loss rate can be reduced to 0 by one-time extension; when the number of available channels is 7, the packet loss rate needs to be reduced to 0 by twice extension of TTL. When the number of available channels is too small, in order to balance the timeliness and integrity of data, the TTL is no longer extended after the threshold reaches 4s, and the packet loss rate is controlled within 0.8‰.
[0089] The above merely describes preferred embodiments of the present application, but does not constitute any other form of limitation on the present application, and any modification or equivalent change made according to the technical essence of the present application still falls within the scope of the present application.
Claims
1. A method for constructing a wireless sensor network protocol carrying Modbus over WiFi, characterized in that: Comprise the following steps: 1) WiFi carries Modbus protocol; The timing of WiFi is redefined, the message type and node state are reduced, and the wireless communication protocol process is simplified; 1.1) Protocol process design; The MAC layer protocol is formulated, which defines the transmission and encapsulation format of data in the network, and restricts the access and use of the channel. The MAC layer protocol of WSN follows a distributed structure; The message type and node state of the MAC protocol process are defined; 1.2) Data frame design; For the encapsulation format of the MAC data frame, the original data frame is first simplified, the redundant bytes are allocated to the data content field, and then the Modbus frame is embedded in the WiFi data frame, using WiFi protocol to carry Modbus protocol; 2) Wireless networking and data transmission process; The wireless networking and data transmission process is divided into: WiFi network initialization, node joining network, Modbus framing, data transmission.
2. The method according to claim 1, wherein the method is characterized in that: The message type and node state of the MAC protocol process in step 1.1) are defined as follows: including message type and node type.
3. The method according to claim 2, wherein the WiFi carries the Modbus protocol of the wireless sensor network. The message type includes: RS is prepared to send data by the source node, and detects whether the channel is idle; CS is the sink node after receiving the RS message, replies to this message, indicating that the current channel is idle and can receive data; ACK is the sink node responding to the successful reception of data and accuracy; DA is the data waiting to be sent.
4. The method according to claim 3, wherein: The protocol process of the node in step 1.1) is as follows: Step1. Assume that a data acquisition sensor in the network is node A, and the network coordinator is node B. When the two nodes have no data to send and receive, they are in a static state Q; Step2. Node A needs to send data to node B, A sends RS message to B, indicating that it has a group of data to send, and detects whether the channel is idle. At this time, A jumps from Q state to WCS state; Step3. After receiving the RS message sent by A, B first judges whether the message destination address is correct. If the address is correct, reply CS message to A, indicating that the current channel is idle and can send data to itself. At this time, B jumps from Q state to WDA state; Step4. After receiving the CS message replied by B, A indicates that the data transmission can be carried out, A encapsulates the data into a data packet, and indicates DA message in the frame control bit. After encapsulation, it is sent to B node. At this time, A jumps from WCS state to WACK state; Step5. After receiving the DA message, B performs FCS check on the data. If the check is incorrect, the data is discarded and an error message is fed back to the upper computer. If the check is correct, the data is received and ACK message is replied to A; Step6. After successfully receiving the ACK message, A indicates that the data transmission is completed, and A and B jump back to Q state and wait for the next data transmission.
5. The method according to claim 1, wherein the method is characterized in that: In step 1.2) data frame design, WiFi protocol is used to carry Modbus protocol, and the data frame format after modification is as follows; (1) Frame Control: 2 bytes, used to indicate four types of messages: RS, CS, ACK, DA, code respectively: 1011, 1100, 1101, 0000; (2) Duration / ID: 2 bytes, used as the NAV setting of WiFi data frame; (3) Destination Address: 6 bytes, used to indicate the location of the sink node; (4) Source Address: 6 bytes, used to indicate the location of the source node; (5) Time Interval: 4 bytes, since the Modbus data frame has no start and end symbols, a 4-character pause interval is specified between the transmission of two Modbus frames, indicating the start of the Modbus frame; (6) Modbus data frame: 256 bytes, the Modbus frame is embedded into the data content field of WiFi, and the encapsulation field is as follows: (6.1) Device Address: 1 byte, used to indicate the initiator of the message, the value is the ID of the sending node, numbered according to the partition of the industrial site, starting from 0x01 and ending at 0xff; (6.2) Function Code: 1 byte, used to indicate the destination of the message, the value is the ID of the target node, defined according to the main task of the node, according to the application scenario, only the first five function codes need to be defined as follows: 01 indicates reading coil status, 02 indicates reading input status, 03 indicates reading holding register, 04 indicates reading input register, and 05 indicates forced coil; (6.3) Instruction Segment Length: 2 bytes, used to indicate the length of the Modbus data frame, which can reduce the verification steps; (6.4) Modbus Instruction Segment: 246 bytes, used to indicate the actual data content or instruction message; (6.5) CRC Check Code: 2 bytes, used to verify the correctness of the Modbus data frame; (7) FCS Check Code: 2 bytes, used to verify the correctness of the WiFi data frame; (8) Four bytes of interval, the second Modbus frame is 256 bytes, four bytes of interval, the third Modbus frame is 256 bytes, four bytes of interval, the fourth Modbus frame is 256 bytes, four bytes of interval, the fifth Modbus frame is 256 bytes, Nul and 2 bytes of FCS check code.
6. The method according to claim 5, wherein the WiFi carries the Modbus protocol of the wireless sensor network. The step 1.2) The designed WiFi data frame has a maximum of 1500 bytes, and a Modbus frame has a maximum of 256 bytes, so a WiFi data packet embeds 5 Modbus data packets, and a WiFi data frame can transmit 5 Modbus frames at a time. After simplifying the message type, the frame control bit has only four codes, which is more convenient to identify. The Duration / ID, Destination Address, Source Address, and FCS Check Code bits all follow the original WiFi format; The device address of Modbus is set according to the number of factory buildings and numbering, and only the first five function codes are enough to indicate all instructions, so the numbers after 05 are not defined. Since the Modbus data frame has no start and end symbols, it is stipulated that there is a 4-character pause interval between two Modbus frame transmissions, and a new Modbus frame is transmitted in less than this time interval, the receiving device will consider it as a continuation of the previous frame, which will cause the CRC check to be wrong and the data reception to fail.
7. The method according to claim 1, wherein the method is characterized in that: The step 1.2) transmits the data of the designed data frame in a transparent mode, the WiFi device does not modify and process the embedded Modbus data packet, and the Modbus instruction does not affect the transmission structure of the WiFi.
8. The method according to claim 1, wherein the method is characterized in that: The WiFi network initialization process is as follows: First, confirm a full-function node, then send a beacon request command outward, and set a scanning period T; if no beacon is detected within the scanning period, it is determined that the node is a coordinator of the network, and a network identifier is selected; The node joining network process is as follows: The premise for data transmission in the network is that the node scans the nearby coordinator and sends a network access request, and the coordinator decides whether to agree to the connection according to the situation after receiving the request; The data transmission process is as follows: The data is encapsulated and then transmitted according to the data link.
Citation Information
Patent Citations
Construction method of directed shortest path spanning tree in wireless sensor network
CN103037468A
Construction method of deviation-type low-cost spanning tree in wireless sensor network
CN103068071A
Internet wireless sensor network protocol construction method
CN107920051A
Method for increasing effective load of wireless self-organizing network
CN104244325A
High coding opportunity bidirectional access method based on cache information assistance
CN108738100A