




技术领域technical field
本发明涉及的是无线数据通信网络构建方法,具体是一种调试移动无线自组网络的协议栈而构建的移动无线自组网的局域网模拟平台方法。The invention relates to a method for constructing a wireless data communication network, in particular to a method for a local area network simulation platform of a mobile wireless ad hoc network constructed by debugging the protocol stack of the mobile wireless ad hoc network.
背景技术Background technique
移动无线自组网络在以下几点上相对于有线网络具有如下特殊性:Mobile wireless ad hoc networks have the following particularities compared to wired networks in the following points:
1、在物理层上,因为无线信号功率有限,其通信覆盖范围有限,即一个设备只能与其通信范围内的节点进行通信。在其通信范围以外的节点只能通过多跳的方式进行数据传递。1. On the physical layer, because the wireless signal power is limited, its communication coverage is limited, that is, a device can only communicate with nodes within its communication range. Nodes outside its communication range can only transmit data through multi-hop.
2、在MAC(Media Access Control,介质访问控制)层可能会有多个无线设备同时接入信道,导致分组之间相互冲突,使接收机无法分辨接收到的数据,导致信道资源浪费,吞吐量显著下降。为了解决这些问题,就需要MAC协议。此协议主要通过一组规则和过程来更有效、有序和公平地使用共享媒体。2. At the MAC (Media Access Control, Media Access Control) layer, there may be multiple wireless devices accessing the channel at the same time, causing conflicts between groups, making the receiver unable to distinguish the received data, resulting in waste of channel resources and poor throughput. Decreased significantly. In order to solve these problems, MAC protocol is needed. This protocol primarily uses a set of rules and procedures for more efficient, orderly, and fair use of shared media.
3、移动Ad hoc网是一种分布的无线通信网络,其最大特点就是没有网络基础设施,完全由一些移动节点临时构成网络,并在节点移动、网络拓扑结构发生变化后能迅速地建立新的传输通道,大多数移动节点都需要具备路由功能。3. The mobile Ad hoc network is a distributed wireless communication network. Its biggest feature is that there is no network infrastructure, and the network is completely composed of some mobile nodes temporarily, and a new network can be quickly established after the node moves and the network topology changes. Transmission channel, most mobile nodes need to have the routing function.
4、因特网中的传输控制协议(TCP)是目前有线网络端到端传输中最流行的协议之一。但因为TCP原本是针对有线固定网络,在流控制和拥塞控制等策略中并未考虑到无线链路与有线链路传输时延上的差距,以及由于移动Ad hoc网络的移动性对网络带来的影响,所以传统的TCP协议不能直接用于Ad hoc网络。4. The Transmission Control Protocol (TCP) in the Internet is one of the most popular protocols in the end-to-end transmission of wired networks. However, because TCP was originally aimed at wired fixed networks, the gap in transmission delay between wireless links and wired links was not considered in strategies such as flow control and congestion control, as well as the impact on the network due to the mobility of mobile Ad hoc networks. Therefore, the traditional TCP protocol cannot be directly used in the Ad hoc network.
要实现移动无线自组网的平台设计,除物理层硬件部分的电路以及相应的软件驱动程序外,最重要的就是对MAC层、网络路由、传输层以及相应得应用层协议的实现。目前存在一些仿真软件例如:NS2、OPNET等,这些软件有强大的模型库,在调试大型的网络协议,和理论研究时是必不可少的,但这些软件大多是支持C++,Tcl,Proto-C等高级语言,且大部分这些软件都是商用的。如果我们要把理论的无线协议栈在硬件上实现,特别是移动无线自组网,由于其单个节点的资源有限,其硬件平台的编译器是不能支持这些仿真软件所使用的高级编程语言的,大多仅仅支持汇编语言和C语言等中低级编程语言。也就是说在我们协议的硬件实现过程中存在一个移植的问题,在移植过程中,还有一些实际问题会出现,特别是对于软件部分的协议栈的实现过程会出现以下一些问题:To realize the platform design of mobile wireless ad hoc network, in addition to the circuit of the physical layer hardware and the corresponding software driver, the most important thing is the realization of the MAC layer, network routing, transport layer and the corresponding application layer protocol. Currently there are some simulation software such as: NS2, OPNET, etc. These software have powerful model libraries, which are essential for debugging large-scale network protocols and theoretical research, but most of these software support C++, Tcl, Proto-C and other high-level languages, and most of these software are commercially available. If we want to implement the theoretical wireless protocol stack on hardware, especially mobile wireless ad hoc network, due to the limited resources of its single node, the compiler of its hardware platform cannot support the high-level programming language used by these simulation software. Most of them only support low-level programming languages such as assembly language and C language. That is to say, there is a problem of transplantation in the hardware implementation process of our protocol. During the transplantation process, some practical problems will appear, especially for the implementation process of the protocol stack in the software part, the following problems will appear:
1、在平台的搭建过程中,往往硬件和软件需要同步进行调试,但无线网络的软件是为工作在硬件平台上,特别是协议栈中链路层、网络层以及传输层等部分,如果没有硬件平台,仅仅在PC平台上把软件部分程序编制好,进行单机调试,往往只能找出其中关于程序语法等方面的错误,很难找到一些逻辑上或者算法上的错误。这就形成了软件需要等待硬件开发完成并完善的矛盾,如果矛盾没有解决好就会造成开发周期延长的问题。1. In the process of building the platform, the hardware and software often need to be debugged simultaneously, but the software of the wireless network is designed to work on the hardware platform, especially the link layer, network layer, and transport layer in the protocol stack. If there is no For the hardware platform, only part of the software program is compiled on the PC platform, and stand-alone debugging can only find errors in program syntax and other aspects, and it is difficult to find some logical or algorithmic errors. This creates a contradiction that the software needs to wait for the hardware development to be completed and improved. If the contradiction is not resolved, the development cycle will be extended.
2、在调试无线协议时,特别是无线自组网的协议时,由于每个节点的平等性,调试时往往需要对多个节点的状态同时跟踪才能找到协议栈的问题。但在实际调试过程中,由于调试仪器(如仿真器等)数量的有限性,往往不能做到,此时如果中间节点出现问题,就会造成调试的困难。2. When debugging wireless protocols, especially wireless ad hoc network protocols, due to the equality of each node, it is often necessary to track the status of multiple nodes at the same time to find the problem of the protocol stack. However, in the actual debugging process, due to the limited number of debugging instruments (such as emulators, etc.), it is often impossible to do it. At this time, if there is a problem in the intermediate node, it will cause difficulty in debugging.
3、为了实现无线自组网的多跳功能时,在调试的过程中,目的节点和发送节点往往需要相隔一定距离,而调试的实际工作环境(如实验室)一般都在这个距离之内,那么就存在调试节点在工作环境以外的情况,那么这种节点的调试可能会受到在户外无电源等因素的影响,而增加调试软件协议的不便。3. In order to realize the multi-hop function of the wireless ad hoc network, in the debugging process, the destination node and the sending node often need to be separated by a certain distance, and the actual working environment (such as the laboratory) of the debugging is generally within this distance. Then there is a situation where the debugging node is outside the working environment, then the debugging of this node may be affected by factors such as no power supply outdoors, which increases the inconvenience of debugging software protocols.
发明内容Contents of the invention
本发明的目的在于针对已有技术存在的问题,提供一种移动无线自组网络的有线局域网模拟平台构建方法,该模拟平台具有上述的移动无线自组网络的特殊性,为上层协议栈软件提供良好的接口,可观测各节点包的发送接收状况,从而便于调试协议栈软件和移植到硬件平台上。The object of the present invention is to aim at the problem that prior art exists, provide a kind of wired local area network simulation platform construction method of mobile wireless ad hoc network, this simulation platform has the particularity of above-mentioned mobile wireless ad hoc network, provides for the upper layer protocol stack software A good interface can observe the sending and receiving status of each node packet, so that it is convenient to debug the protocol stack software and transplant it to the hardware platform.
为了达到上述目的,本发明采用下述技术方案:In order to achieve the above object, the present invention adopts following technical scheme:
一种移动无线自组网络的有线局域网模拟平台构建方法,其特征在于在有线局域网环境内,采用有线局域网络中的一台模拟平台主机和多台模拟平台客户机的模式构建移动无线自组网络。所述的模拟平台主机提供协议调试者进行网络参数的设置,并把网络参数传送给模拟平台的客户机;当有节点移动时,需要计算移动节点不同时刻的位置坐标,并传送给其他客户机,此外,还需要给其他客户机提供同步时钟;所述模拟平台客户机是模拟无线自组网络中的多个节点,并模拟多个节点的自移动过程。在上述的移动无线自组网络的有线局域网模拟平台中,所述的模拟平台主机的具体操作步骤:A method for constructing a wired local area network simulation platform of a mobile wireless ad hoc network, characterized in that in a wired local area network environment, a mobile wireless ad hoc network is constructed in the mode of one simulation platform host computer and multiple simulation platform clients in the wired local area network . The simulation platform host provides the protocol debugger to set the network parameters, and transmits the network parameters to the client of the simulation platform; when a node moves, it is necessary to calculate the position coordinates of the mobile node at different times, and transmit it to other clients , in addition, it is also necessary to provide synchronous clocks to other clients; the simulation platform client simulates multiple nodes in the wireless ad hoc network and simulates the self-moving process of multiple nodes. In the wired LAN simulation platform of the above-mentioned mobile wireless ad hoc network, the specific operation steps of the simulation platform host:
步骤1:等待用户在调试前设定本机配置以及网络的参数,并做好初始化工作具体的用户输入信息在后面的用户使用接口中的输入部分有详细指定;Step 1: Wait for the user to set the local configuration and network parameters before debugging, and do a good job of initialization. The specific user input information is specified in detail in the input part of the user interface later;
步骤2:周期性的向网络内所有节点传送定时同步时钟和无线网络中各节点实时位置坐标信息;Step 2: periodically transmit the timing synchronization clock and the real-time position coordinate information of each node in the wireless network to all nodes in the network;
步骤3:考察有无移动节点;Step 3: Investigate whether there is a mobile node;
步骤4:按照匀速直线运动模型计算移动节点此时刻的位置信息,并更新所存储无线网络所有节点位置信息表,以备步骤2中向网络中所有节点发送无线网络各节点实时位置坐标信息能得以更新;Step 4: Calculate the position information of the mobile node at this moment according to the uniform linear motion model, and update the stored position information table of all nodes in the wireless network, so that the real-time position coordinate information of each node in the wireless network can be sent to all nodes in the network in
步骤5:根据无线网络中所有节点位置信息,考察其它节点是否在本机节点以自身为中心,最大可通信距离为半径的圆形区域内的方法来计算本机节点可直接通信所有邻居节点地址;Step 5: According to the location information of all nodes in the wireless network, check whether other nodes are in the circular area with the local node as the center and the maximum communicable distance as the radius to calculate the addresses of all neighbor nodes that the local node can directly communicate with ;
步骤6:查询有线局域网络上是否有数据包到来;Step 6: Query whether there are data packets arriving on the wired LAN;
步骤7:如果有数据包到来,则数据包进入数据包接收处理模块,此模块具体流程在图6中有详细分解,最终此模块把网络上的数据包进行过滤,把满足真实无线网络环境的数据包传送到上层协议;Step 7: If a data packet arrives, the data packet enters the data packet receiving and processing module. The specific flow of this module is decomposed in detail in Figure 6. Finally, this module filters the data packets on the network and filters the data packets that meet the real wireless network environment. The data packet is sent to the upper layer protocol;
步骤8:考察上层协议是否有数据包需要发送;Step 8: Check whether the upper layer protocol has data packets to send;
步骤9:当上层协议有数据包需要发送时,调用无线数据包发送模块,进行封包并把数据传送到局域网内的其他节点;Step 9: When the upper layer protocol has a data packet to be sent, call the wireless data packet sending module to packetize and transmit the data to other nodes in the LAN;
步骤10:对模拟平台中需要考虑的一些定时计数器进行处理,主要包括定时发送同步包计数器,定时发送移动节点位置信息计数器,CCA计数器。Step 10: Process some timing counters that need to be considered in the simulation platform, mainly including timing sending synchronization packet counters, timing sending mobile node location information counters, and CCA counters.
在移动无线自组网络的有线局域网模拟平台中,所述的模拟平台客户机的具体操作步骤:In the wired local area network simulation platform of mobile wireless ad hoc network, the concrete operation steps of described simulation platform client computer:
步骤1:请求网络主机传送网络配置信息。该过程可以防止重复在每台机器上输入网络配置信息;Step 1: Request the network host to transmit network configuration information. This process prevents repeated entry of network configuration information on each machine;
步骤2:等待网络主机传送网络配置信息,并进行初始化工作;Step 2: Wait for the network host to transmit network configuration information, and perform initialization work;
步骤3:查询网络主机是否传送时间同步包和无线网络各节点位置信息的数据包;Step 3: Check whether the network host transmits time synchronization packets and data packets of location information of each node in the wireless network;
步骤4:更新本机的时钟和无线网络所有节点位置信息;Step 4: Update the local clock and the location information of all nodes in the wireless network;
步骤5:根据无线网络中所有节点位置信息,考察其它节点是否在本机节点以自身为中心,最大可通信距离为半径的圆形区域内的方法来计算本机节点可直接通信所有邻居节点地址;Step 5: According to the location information of all nodes in the wireless network, check whether other nodes are in the circular area with the local node as the center and the maximum communicable distance as the radius to calculate the addresses of all neighbor nodes that the local node can directly communicate with ;
步骤6:查询网络端口上是否有数据包到来,若有数据包进入TCP或UDP数据接收模块,此模块把该数据包进行过滤,把满足真实无线网络环境的数据包传送到上层协议;Step 6: Query whether there is a data packet coming on the network port, if any data packet enters the TCP or UDP data receiving module, this module filters the data packet, and transmits the data packet that meets the real wireless network environment to the upper layer protocol;
步骤7:考察上层协议是否有数据包需要发送;Step 7: Check whether the upper layer protocol has data packets to send;
步骤8:当上层协议有数据包需要发送时,调用无线数据包发送模块,进行封包并把数据传送到局域网内的其他节点。Step 8: When the upper layer protocol has a data packet to be sent, call the wireless data packet sending module to packetize and transmit the data to other nodes in the LAN.
本发明与现有技术相比较,具有如下显而易见的突出实质性特点和显著优点。本发明提供的方法所构建的移动无线自组网络的有线局域网模拟平台具有以下功能:Compared with the prior art, the present invention has the following obvious outstanding substantive features and remarkable advantages. The wired LAN simulation platform of the mobile wireless ad hoc network constructed by the method provided by the invention has the following functions:
1、具有无线通信道分组冲突机制和无线发送模块的CCA(clear channel assessment,信道空闲评估)功能,可利用此特点调试数据链路层协议栈。1. It has the wireless communication channel packet collision mechanism and the CCA (clear channel assessment) function of the wireless transmission module, which can be used to debug the data link layer protocol stack.
2、具有无线信道邻域接收功能,每个节点只能接收其领域范围的节点分组数据,且支持无线单向传输功能,模拟了实际的无线环境。2. It has the wireless channel neighborhood receiving function, and each node can only receive node packet data within its domain, and supports wireless one-way transmission function, simulating the actual wireless environment.
3、支持多节点的移动功能,移动模型为匀速直线运动,模拟移动网络特性,从而支持上层调试移动自组网的协议栈。3. Support the mobile function of multiple nodes. The mobile model is a uniform linear motion, simulating the characteristics of the mobile network, thereby supporting the upper layer to debug the protocol stack of the mobile ad hoc network.
4、给上层协议栈提供良好的发送和接收包的接口函数。4. Provide good interface functions for sending and receiving packets to the upper layer protocol stack.
通过在局域网内多机环境下编写相应的软件模拟实际的移动无线自组网络环境。无线自组网协议栈开发者在该平台的基础上开发相应得物理层以上的协议,包括MAC(Media Access Control,介质访问控制)协议、网络路由协议、传输层协议、应用层协议等。开发基于硬件的无线自组网协议的用户在具有这些功能的移动无线自组网络的局域网模拟平台上开发协议栈,可以大大减少开发周期和难度。The actual mobile wireless ad hoc network environment is simulated by writing corresponding software in the multi-computer environment in the local area network. On the basis of this platform, developers of wireless ad hoc network protocol stacks develop corresponding protocols above the physical layer, including MAC (Media Access Control, Media Access Control) protocol, network routing protocol, transport layer protocol, application layer protocol, etc. Users who develop hardware-based wireless ad hoc network protocols develop protocol stacks on the LAN simulation platform of mobile wireless ad hoc networks with these functions, which can greatly reduce the development cycle and difficulty.
附图说明Description of drawings
图1模拟移动无线自组网在软件协议中的地位。Figure 1 simulates the position of mobile wireless ad hoc networks in software protocols.
图2模拟平台接收数据报文的过程。Figure 2 simulates the process of the platform receiving data packets.
图3模拟平台接收数据时的总体过程。Figure 3 simulates the overall process when the platform receives data.
图4模拟平台中的网络主机工作流程。Figure 4. Network host workflow in the simulated platform.
图5模拟平台中的网络从机工作流程。Fig. 5 The network slave workflow in the simulation platform.
图6模拟平台总体流程中的TCP或UDP接收模块的具体处理流程。Figure 6 is the specific processing flow of the TCP or UDP receiving module in the overall flow of the simulation platform.
图7模拟平台总体流程中扫描接收缓冲区的具体处理流程Figure 7 The specific processing flow of scanning the receiving buffer in the overall flow of the simulation platform
图8模拟平台报文报头结构。其中报文里每一项的含义如下:Figure 8 simulates the packet header structure of the platform. The meaning of each item in the message is as follows:
目的节点IP地址:该包的接收方在局域网内对应的目的IP地址,地址为Destination node IP address: the destination IP address corresponding to the receiver of the packet in the local area network, the address is
0xFFFFFFFF时表明此包是广播包。When 0xFFFFFFFF indicates that the packet is a broadcast packet.
源节点IP地址: 该包的发送方在局域网内对应的IP地址Source node IP address: The corresponding IP address of the sender of the packet in the local area network
信道编号: 该包在无线信道里所使用的信道编号,最大支持255个信道Channel number: The channel number used by the package in the wireless channel, up to 255 channels are supported
包类型: 该包的数据域类型,为0是数据包,为1是控制包Packet type: The data field type of the packet, 0 is a data packet, and 1 is a control packet
底层传输模式标志:标识底层采用得传输机制,为1使用UDP传输,为2使用TCPUnderlying transmission mode flag: identify the transmission mechanism adopted by the underlying, use UDP transmission for 1, and use TCP for 2
传输,可扩展其他通讯方式。Transmission, other communication methods can be expanded.
包发送时间: 该包发送后需要占用信道的时间Packet sending time: The time that the packet needs to occupy the channel after it is sent
发送时间戳: 包发送时的时间Send timestamp: the time when the packet was sent
接收时间戳: 包接收时的时间Receive timestamp: The time when the packet was received
具体实施方式Detailed ways
本发明的一个实施案例结合附图祥述如下:An implementation case of the present invention is described as follows in conjunction with accompanying drawing:
使用者可在下述构建的模拟的移动无线自组网平台上进行协议栈的调试。该模拟平台由有线局域网络中一台主机和多台客户机构成,使用者分别在主机上和客户机的软件中加载自身的软件协议程序。整个平台在使用者调试的协议栈软件中所处的地位如图1所示,移动无线自组网模拟平台软件部分提供给调试的无线软件协议栈调试者使用,协议栈中所有最终要传输到无线信道中的数据包经过该模拟平台的分析模块进行包的解析,最终以TCP/IP包的形式在有线局域网中传输。Users can debug the protocol stack on the simulated mobile wireless ad hoc network platform constructed as follows. The simulation platform is composed of a host computer and multiple client computers in a wired local area network, and users load their own software protocol programs on the host computer and the software of the client computers respectively. The status of the entire platform in the protocol stack software debugged by users is shown in Figure 1. The software part of the mobile wireless ad hoc network simulation platform is provided to the debugger of the wireless software protocol stack for debugging. The data packets in the wireless channel are analyzed by the analysis module of the simulation platform, and finally transmitted in the wired LAN in the form of TCP/IP packets.
模拟移动无线自组网平台为上层协议栈提供无线信道数据发送和接收两个接口,如图2所示即为当上层协议栈需要把数据报文传送到无线网络的其他节点时的过程。模拟平台软件部分提供接口函数把上层协议栈的数据包按照图8中的包格式进行打包后传输到其他节点。该接口函数需要检测上层协议栈是否考虑CCA检测传送,若需要则检测模拟平台的CCA计数器是否为零来判断信道是否空闲,使用上层用户的MAC层传输协议发送数据,该功能主要提供给用户开发MAC层协议栈。The simulated mobile wireless ad hoc network platform provides two interfaces for wireless channel data transmission and reception for the upper layer protocol stack. As shown in Figure 2, it is the process when the upper layer protocol stack needs to transmit data packets to other nodes in the wireless network. The software part of the simulation platform provides interface functions to pack the data packets of the upper layer protocol stack according to the packet format in Figure 8 and transmit them to other nodes. This interface function needs to check whether the upper layer protocol stack considers CCA detection and transmission. If necessary, check whether the CCA counter of the simulation platform is zero to judge whether the channel is idle, and use the MAC layer transmission protocol of the upper layer user to send data. This function is mainly provided for user development. MAC layer protocol stack.
当模拟平台一个节点收到从局域网络上传送来数据包时,其处理数据包过程如图3所示,模拟平台接收到网络上一个TCP/IP数据包经过模拟平台的软件模块进行处理,一方面记录所传输的报文,另一方面只把符合要求的报文传送到上层协议栈。When a node of the simulation platform receives a data packet transmitted from the local area network, its process of processing the data packet is shown in Figure 3. The simulation platform receives a TCP/IP data packet on the network and processes it through the software module of the simulation platform. On the one hand, it records the transmitted messages, on the other hand, it only transmits the messages that meet the requirements to the upper layer protocol stack.
模拟网络平台内主机主要提供给协议调试者进行网络参数的设置,并把网络参数传送给其他的客户机,当有节点移动时,需要计算移动节点不同时刻的位置坐标并传送给其他客户机,此外还需要给其他客户机提供同步时钟。其内部具体工作流程如图4所示。The host in the simulated network platform is mainly provided for the protocol debugger to set the network parameters and transmit the network parameters to other clients. When a node moves, it is necessary to calculate the position coordinates of the mobile node at different times and transmit them to other clients. In addition, it is necessary to provide synchronous clocks to other clients. Its internal specific workflow is shown in Figure 4.
S4-1:等待用户在调试前设定本机配置以及网络的参数,并做好初始化工作具体的用户输入信息在后面的用户使用接口中的输入部分有详细指定。S4-1: Waiting for the user to set the local configuration and network parameters before debugging, and do a good job of initialization. The specific user input information is specified in detail in the input part of the user interface later.
S4-2:周期性的向网络内所有节点传送定时同步时钟和无线网络中各节点实时位置坐标信息。S4-2: Periodically transmit the timing synchronization clock and the real-time position coordinate information of each node in the wireless network to all nodes in the network.
S4-3:考察有无移动节点。S4-3: Investigate whether there is a mobile node.
S4-4:按照匀速直线运动模型计算移动节点此时刻的位置信息,并更新所存储无线网络所有节点位置信息表,以备S4-2中向网络中所有节点发送无线网络各节点实时位置坐标信息能得以更新。S4-4: Calculate the position information of the mobile node at this moment according to the uniform linear motion model, and update the stored position information table of all nodes in the wireless network, so as to prepare for sending real-time position coordinate information of each node in the wireless network to all nodes in the network in S4-2 can be updated.
S4-5:根据无线网络中所有节点位置信息,考察其它节点是否在本机节点以自身为中心,最大可通信距离为半径的圆形区域内的方法来计算本机节点可直接通信所有邻居节点地址。S4-5: According to the location information of all nodes in the wireless network, check whether other nodes are in the circular area with the local node as the center and the maximum communicable distance as the radius to calculate that the local node can directly communicate with all neighbor nodes address.
S4-6:查询有线局域网络上是否有数据包到来。S4-6: Query whether there are data packets arriving on the wired LAN.
S4-7:如果有数据包到来,则数据包进入数据包接收处理模块,此模块具体流程在图6中有详细分解,最终此模块把网络上的数据包进行过滤,把满足真实无线网络环境的数据包传送到上层协议。S4-7: If a data packet arrives, the data packet enters the data packet receiving and processing module. The specific process of this module is decomposed in detail in Figure 6. Finally, this module filters the data packets on the network to meet the requirements of the real wireless network environment. The data packet is sent to the upper layer protocol.
S4-8:考察上层协议是否有数据包需要发送。S4-8: Investigate whether the upper layer protocol has data packets to send.
S4-9:当上层协议有数据包需要发送时,调用无线数据包发送模块,进行封包并把数据传送到局域网内的其他节点。S4-9: When the upper layer protocol has a data packet to be sent, call the wireless data packet sending module to packetize and transmit the data to other nodes in the LAN.
S4-10:对模拟平台中需要考虑的一些定时计数器进行处理,主要包括定时发送同步包计数器,定时发送移动节点位置信息计数器,CCA计数器等。S4-10: Process some timing counters that need to be considered in the simulation platform, mainly including timing sending synchronization packet counters, timing sending mobile node location information counters, CCA counters, etc.
模拟平台的网络客户机主要目的是为了模拟无线自组网中多个节点,并模拟多个节点的自移动过程,其内部工作流程如图5所示。The main purpose of the network client of the simulation platform is to simulate multiple nodes in the wireless ad hoc network and simulate the self-moving process of multiple nodes. Its internal working process is shown in Figure 5.
S5-1:请求网络主机传送网络配置信息。该过程可以防止重复在每台机器上输入网络配置信息。S5-1: Request the network host to transmit network configuration information. This process prevents repeated entry of network configuration information on each machine.
S5-2:等待网络主机传送网络配置信息,并进行初始化工作。S5-2: Waiting for the network host to transmit network configuration information, and perform initialization work.
S5-3:查询网络主机是否传送时间同步包和无线网络各节点位置信息的数据包。S5-3: Query whether the network host transmits time synchronization packets and data packets of location information of each node in the wireless network.
S5-4:更新本机的时钟和无线网络所有节点位置信息。S5-4: Update the local clock and the location information of all nodes in the wireless network.
S5-5:根据所有节点位置信息计算本机节点所有的邻居节点。方法和S4-5里的方法一致。S5-5: Calculate all the neighbor nodes of the local node according to the location information of all nodes. The method is consistent with the method in S4-5.
S5-6:查询网络端口上是否有数据包到来,若有进入TCP或UDP数据接收模块,此模块具体流程在图6中有详细分解,最终此模块把网络上的数据包进行过滤,把满足真实无线网络环境的数据包传送到上层协议。S5-6: Query whether there is a data packet coming on the network port. If it enters the TCP or UDP data receiving module, the specific process of this module is decomposed in detail in Figure 6. Finally, this module filters the data packets on the network to satisfy the The data packets of the real wireless network environment are transmitted to the upper layer protocol.
S5-7:考察上层协议是否有数据包需要发送。S5-7: Investigate whether the upper layer protocol has data packets to send.
S5-8:当上层协议有数据包需要发送时,调用无线数据包发送模块,进行封包并把数据传送到局域网内的其他节点。S5-8: When the upper layer protocol has data packets to be sent, call the wireless data packet sending module to packetize and transmit the data to other nodes in the LAN.
在主机和客户机的数据流程中都有当查询到网络中有数据到来时,进入包处理模块,该模块的具体实现流程如图6所示。In the data flow of the host computer and the client computer, when it is found that there is data coming in the network, it will enter the packet processing module. The specific implementation flow of this module is shown in Figure 6.
S6-1:通过socket查询到网络上是否有数据到来。S6-1: Query whether there is data coming on the network through the socket.
S6-2:查询包头,判断是否为无线数据包,也就是是否为需要送入上层的数据包。S6-2: Query the packet header to determine whether it is a wireless data packet, that is, whether it is a data packet that needs to be sent to the upper layer.
S6-3:是无线数据包,解析该包的源地址是否为其邻居节点,因为每个节点只能接收其邻居范围内的节点数据包,此外,如果支持单向传输功能,需要检测此包的目的地址是否为广播包,若不是广播包,就需要查询该包的目的地址是否为本机,如果不为本机则同样作为错误包处理。S6-3: It is a wireless data packet, analyze whether the source address of the packet is its neighbor node, because each node can only receive the node data packet within its neighbor range, in addition, if it supports the one-way transmission function, this packet needs to be detected Whether the destination address of the packet is a broadcast packet, if it is not a broadcast packet, you need to check whether the destination address of the packet is the local machine, if not, it will also be treated as an error packet.
S6-4:在缓冲队列中查找是否存在同一信道冲突的报文,此处是通过模拟平台软件包头中的发送时间戳来进行比较,同一个信道标示的报文,发送时间戳只有相隔大于最大信道分组冲突间隔时间时才能判定为无冲突报文,否则做出错报文处理。S6-4: Check in the buffer queue whether there are conflicting messages on the same channel. Here, the comparison is made by sending timestamps in the header of the software package on the simulation platform. For messages marked on the same channel, the sending timestamps must be separated by a distance greater than the maximum Only when the channel group collision interval time can it be determined that there is no conflict message, otherwise the wrong message will be processed.
S6-5:对于没有出错的报文,不能马上送给上层协议栈,必须缓存到接收缓冲区中,并设定生存时间(等于当前时间加上最大信道分组冲突间隔时间),此举的目的是防止此包和后发送的包发生冲突的问题。S6-5: For messages without errors, they cannot be sent to the upper layer protocol stack immediately, but must be cached in the receiving buffer, and the survival time (equal to the current time plus the maximum channel packet conflict interval time) is set. The purpose of this It is a matter of preventing this packet from colliding with packets sent later.
S6-6:进入扫描缓冲队列模块,缓冲队列处理模块在图7中有详细介绍,该模块主要完成,把缓冲队列中符合实际无线环境的无线数据包传送到上层协议中。S6-6: Enter the scan buffer queue module. The buffer queue processing module is introduced in detail in Figure 7. This module is mainly completed, and the wireless data packets in the buffer queue that conform to the actual wireless environment are transmitted to the upper layer protocol.
S6-7:对于出错的报文,输出到出错文件,用于记录出错报文信息。S6-7: For the error message, output to the error file, which is used to record the error message information.
S6-8:删除发生冲突的所有报文,包括刚收的报文以及和缓冲队列中发生冲突的所有报文。S6-8: Delete all messages in conflict, including the message just received and all messages in conflict with the buffer queue.
S6-9:判断从网络上接收到的是否为模拟平台的同步包。S6-9: Judging whether the synchronization packet received from the network is a simulation platform.
S6-10:判断从网络上接收到的是否为请求网络配置包。S6-10: judging whether the packet received from the network is a request network configuration packet.
S6-11:若接收到请求网络配置包,则向网络传送网络配置信息包。主要是提供给网络主机使用。S6-11: If the request network configuration packet is received, transmit the network configuration information packet to the network. It is mainly used by web hosts.
S6-12:判断从网络上接收到的是否为主机传送的网络配置信息包。S6-12: Determine whether the network configuration information packet received from the network is sent by the host.
S6-13:若接收到网络配置信息包,该节点则重新配置网络信息。主要是提供给网络从机使用。S6-13: If the network configuration information packet is received, the node reconfigures the network information. It is mainly used for network slaves.
S6-14:接收到同步包后,需要校正本机时钟。S6-14: After receiving the synchronization packet, the local clock needs to be corrected.
在以上步骤中涉及到接收包的缓冲区的处理过程,该过程主要是为了模拟实际无线自组网络中信道帧数据冲突机制,刚收到的无线链路数据包不能马上送往上层协议处理,要缓存一定时间防止后续包对该包冲突。其具体实现机制如图7所示。The above steps involve the processing of the buffer of the received packet. This process is mainly to simulate the channel frame data collision mechanism in the actual wireless ad hoc network. The wireless link data packet just received cannot be sent to the upper layer protocol for processing immediately. It is necessary to cache for a certain period of time to prevent subsequent packages from conflicting with the package. Its specific implementation mechanism is shown in Figure 7.
S7-1:扫描缓冲队列里面每一个的数据包。S7-1: Scan each data packet in the buffer queue.
S7-2:查询每个扫描的每个报文生存时间是否到达。S7-2: Query whether the lifetime of each packet of each scan is reached.
S7-3:该包的生存时间已到,去掉该包的模拟平台接口包头。S7-3: The survival time of the package has expired, remove the simulation platform interface header of the package.
S7-4:在缓冲区中删除此包,并调用接收函数把该包传送到上层协议栈。S7-4: Delete the packet in the buffer, and call the receiving function to transfer the packet to the upper protocol stack.
S7-5:判断是否扫描完缓冲区中所有的报文。S7-5: Determine whether all the messages in the buffer have been scanned.
因为该平台是构架于有线局域网络,协议栈的数据包需要通过该平台的软件模块进行数据打包然后整体做为TCP/IP包的数据部分传输。图8即为模拟平台软件模块对数据打包后报文头的具体信息。Because the platform is built on a wired local area network, the data packets of the protocol stack need to be packaged through the software modules of the platform and then transmitted as a whole as the data part of the TCP/IP packet. Figure 8 is the specific information of the message header after the data is packaged by the simulation platform software module.
此外本地节点需要维护的资源有:支持的信道编号及信道分组冲突时间,本机局域网IP地址与模拟移动无线网络中的节点地址对应表,数据传输方式,同步的时间计数器。In addition, the resources that the local node needs to maintain include: supported channel number and channel group conflict time, the corresponding table between the local area network IP address and the node address in the simulated mobile wireless network, data transmission mode, and synchronized time counter.
用户使用接口:User interface:
输入部分:Input section:
1、设定模拟的移动无线自组网中节点地址和本机IP地址的映射关系,即输入本机在移动无线自组网中的地址。1. Set the mapping relationship between the node address in the simulated mobile ad hoc network and the local IP address, that is, input the address of the local machine in the mobile wireless ad hoc network.
2、随时输入或改变每个节点可直接通信节点地址,从而设定一跳范围内可通信的节点地址。2. Input or change the address of each node that can directly communicate with each other at any time, so as to set the address of the node that can communicate within one hop.
3、设定是手动还是自动改变节点一跳通信节点,来实现无线环境中节点的移动性。3. Set whether to manually or automatically change the node-hop communication node to realize the mobility of nodes in the wireless environment.
4、设定各信道分组冲突间隔时间,由于无线网络物理层结构不相同,分组冲突的特性并不是一致。4. Set the interval time between packet collisions of each channel. Since the physical layer structures of wireless networks are not the same, the characteristics of packet collisions are not consistent.
5、选择所支持无线传输类型,包括是使用TCP还是是用UDP传送,可以选择在模拟平台的底层采用UDP方式传输数据。5. Select the supported wireless transmission type, including whether to use TCP or UDP to transmit data. You can choose to use UDP to transmit data at the bottom of the simulation platform.
为上层协议栈软件提供的接口有:The interfaces provided for the upper layer protocol stack software are:
1、提供发送函数,u_int8_t packet_transfer(struct Packet*p,int type,void(*MacTran)());该函数供调试的协议栈在需要把分组发送到物理层时调用。1. Provide the sending function, u_int8_t packet_transfer(struct Packet*p, int type, void(*MacTran)()); this function is called by the protocol stack for debugging when it needs to send the packet to the physical layer.
2、在接收到消息处理函数指针,在模拟平台中有全局变量的函数指针用于处理所接收到的包void(*p_do_receive_packet)(struct Packet*p);使用该移动无线平台时,把调试的协议栈接收函数指针赋值为该变量即可。2. After receiving the message processing function pointer, there is a global variable function pointer in the simulation platform to process the received packet void(*p_do_receive_packet)(struct Packet*p); when using the mobile wireless platform, put the debugging The protocol stack receives the function pointer and assigns it to this variable.
4、文件ReceiveData.txt里存放所有接收过的包信息,包信息里存放目的地址,源地址,发送时间,接收时间,本机是否接收等信息,提供调试者分析网络包传输情况。4. The file ReceiveData.txt stores all the received packet information. The packet information stores the destination address, source address, sending time, receiving time, whether the machine receives and other information, and provides the debugger to analyze the network packet transmission situation.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2005101119305ACN100401705C (en) | 2005-12-23 | 2005-12-23 | Construction method of wired local area network simulation platform for mobile wireless ad hoc network |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2005101119305ACN100401705C (en) | 2005-12-23 | 2005-12-23 | Construction method of wired local area network simulation platform for mobile wireless ad hoc network |
| Publication Number | Publication Date |
|---|---|
| CN1794679A CN1794679A (en) | 2006-06-28 |
| CN100401705Ctrue CN100401705C (en) | 2008-07-09 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB2005101119305AExpired - Fee RelatedCN100401705C (en) | 2005-12-23 | 2005-12-23 | Construction method of wired local area network simulation platform for mobile wireless ad hoc network |
| Country | Link |
|---|---|
| CN (1) | CN100401705C (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104735820B (en)* | 2015-04-07 | 2018-01-05 | 无锡职业技术学院 | Checking system on the spot based on sensor self-organized algorithm |
| WO2016187781A1 (en)* | 2015-05-25 | 2016-12-01 | 华为技术有限公司 | Packet processing method and apparatus |
| CN107786684B (en)* | 2017-09-28 | 2020-10-16 | 中南林业科技大学 | A simulation method of mobile ad hoc network address automatic allocation protocol in NS2 |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040117747A1 (en)* | 2002-12-16 | 2004-06-17 | Chen Liang T. | Method for providing cycle-by-cycle ad hoc verification in a hardware-accelerated environment |
| US20040128543A1 (en)* | 2002-12-31 | 2004-07-01 | International Business Machines Corporation | Method and system for morphing honeypot with computer security incident correlation |
| WO2004098126A1 (en)* | 2003-05-01 | 2004-11-11 | Koninklijke Philips Electronics N.V. | An ad-hoc network, a network device and a method of configuration management therefor |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20040117747A1 (en)* | 2002-12-16 | 2004-06-17 | Chen Liang T. | Method for providing cycle-by-cycle ad hoc verification in a hardware-accelerated environment |
| US20040128543A1 (en)* | 2002-12-31 | 2004-07-01 | International Business Machines Corporation | Method and system for morphing honeypot with computer security incident correlation |
| WO2004098126A1 (en)* | 2003-05-01 | 2004-11-11 | Koninklijke Philips Electronics N.V. | An ad-hoc network, a network device and a method of configuration management therefor |
| Publication number | Publication date |
|---|---|
| CN1794679A (en) | 2006-06-28 |
| Publication | Publication Date | Title |
|---|---|---|
| Wang et al. | The design and implementation of the NCTUns 1.0 network simulator | |
| Heidemann et al. | Building efficient wireless sensor networks with low-level naming | |
| US6134514A (en) | Large-scale network simulation method and apparatus | |
| CN101887379B (en) | Virtual network card-based wireless channel simulation method | |
| CN101645813B (en) | Distributed semi-physical network simulation system and controlling method of semi-physical port thereof | |
| Flynn et al. | Jemu: A real time emulation system for mobile ad hoc networks | |
| CN103200190B (en) | A kind of cut-in method in kind towards QualNet network hardware-in-the-loop simulation | |
| Lenders et al. | Connecting the world of embedded mobiles: The RIOT approach to ubiquitous networking for the Internet of Things | |
| CN113378364B (en) | Co-simulation method of wireless network control system | |
| CN1750485A (en) | Network simulation detection system and method | |
| Wiberg | Porting AODV-UU implementation to ns-2 and Enabling Trace-based Simulation | |
| CN1231032C (en) | Network protocol measuring method and measuring system thereof | |
| CN108737169A (en) | A kind of isomery industrial network central fusion management method based on SDN | |
| Wang et al. | NCTUns network simulation and emulation for wireless resource management | |
| CN102006610B (en) | Dynamic adjustment method of nodes in Internet of Things system | |
| Kölsch et al. | Hardware-in-the-loop simulation for Internet of Things scenarios | |
| CN100401705C (en) | Construction method of wired local area network simulation platform for mobile wireless ad hoc network | |
| CN105703946A (en) | Method oriented to QualNet for correcting simulated scene node information regularly | |
| Flynn et al. | A real-time emulation system for ad hoc networks | |
| CN113660688A (en) | Battlefield remote large-scale dense networking semi-physical simulation platform | |
| TAN et al. | Analysis of industrial internet of things and digital twins | |
| Barr | Swans-scalable wireless ad hoc network simulator | |
| Huang et al. | Simulation and analysis of protocols in ad hoc network | |
| Zeng et al. | An ns-3 compatible emulation framework for underwater acoustic network | |
| Xiong et al. | An approach for verifying routing protocols in mobile ad hoc networks using Petri nets |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| C41 | Transfer of patent application or patent right or utility model | ||
| TR01 | Transfer of patent right | Effective date of registration:20090515 Address after:No. 99, Da Dao, Baoshan District, Shanghai: 200444 Co-patentee after:SHANGHAI ZHAOFU ELECTRONIC TECHNOLOGY CO., LTD. Patentee after:Shanghai University Address before:No. 99, Da Dao, Baoshan District, Shanghai: 200444 Patentee before:Shanghai University | |
| C17 | Cessation of patent right | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20080709 Termination date:20131223 |