[go: up one dir, main page]

CN103945415B - Communication implementation method for wireless network - Google Patents

Communication implementation method for wireless network Download PDF

Info

Publication number
CN103945415B
CN103945415B CN201410202748.XA CN201410202748A CN103945415B CN 103945415 B CN103945415 B CN 103945415B CN 201410202748 A CN201410202748 A CN 201410202748A CN 103945415 B CN103945415 B CN 103945415B
Authority
CN
China
Prior art keywords
node
beacon frame
grid
network
type
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.)
Active
Application number
CN201410202748.XA
Other languages
Chinese (zh)
Other versions
CN103945415A (en
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.)
Changshu Intellectual Property Operation Center Co ltd
Original Assignee
Changshu Institute of Technology
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 Changshu Institute of Technology filed Critical Changshu Institute of Technology
Priority to CN201410202748.XA priority Critical patent/CN103945415B/en
Publication of CN103945415A publication Critical patent/CN103945415A/en
Application granted granted Critical
Publication of CN103945415B publication Critical patent/CN103945415B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

本发明提供了一种无线网络的通信实现方法,所述无线网络的活动区域由2n1×2n2个二维的正方形网格构成,n1和n2为正整数,边长为r为移动节点的传输半径,每个网格的坐标为(x,y),x<2n1,y<2n2,x和y为非负整数;移动节点通过GPS技术获取自己的地理坐标(Gx,Gy),然后根据公式获取其所在网格的坐标。此项技术可以应用于车载监控、医疗健康、军事国防等诸多领域,例如,在车载监控领域,可将无线网络的通信实现方法技术应用于道路拥塞监控,每台车辆里可安装多个节点,这些节点实现配置地址后,可以进行信息通信,传输道路交通情况,以有效避免道路拥塞,保持交通畅通,因此,本技术具有很高的推广价值。

The present invention provides a wireless network communication implementation method, the active area of the wireless network is composed of 2 n1 × 2 n2 two-dimensional square grids, n1 and n2 are positive integers, and the side length is r is the transmission radius of the mobile node, the coordinates of each grid are (x, y), x<2 n1 , y<2 n2 , x and y are non-negative integers; the mobile node obtains its own geographic coordinates through GPS technology ( Gx,Gy), and then obtain the coordinates of the grid where it is located according to the formula. This technology can be applied to many fields such as vehicle monitoring, medical health, military defense, etc. For example, in the field of vehicle monitoring, the communication implementation method technology of wireless network can be applied to road congestion monitoring, and multiple nodes can be installed in each vehicle. After these nodes are configured with addresses, they can carry out information communication and transmit road traffic conditions, so as to effectively avoid road congestion and keep traffic smooth. Therefore, this technology has high promotion value.

Description

一种无线网络的通信实现方法A method for implementing wireless network communication

技术领域technical field

本发明涉及一种通信实现方法,尤其涉及的是一种无线网络的通信实现方法。The invention relates to a communication realization method, in particular to a wireless network communication realization method.

背景技术Background technique

无线网络中的节点之间通信通过中间节点的转发和路由来实现,因此,每个节点必须配有具有唯一性的地址来实现通信,因此,实现无线网络需要解决的关键技术之一就是地址自动配置问题。The communication between nodes in the wireless network is realized through the forwarding and routing of intermediate nodes. Therefore, each node must be equipped with a unique address to achieve communication. Therefore, one of the key technologies that need to be solved to realize the wireless network is address automatic Configuration problem.

目前的地址配置分为有状态地址配置和无状态地址配置两种形式,有状态地址配置方案采用服务器/客户端的通信方式分配地址,即节点向服务器提出申请地址的请求,然后由服务器统一为网络内的节点分配地址。由于移动自组网没有任何基础设施,例如服务器,因此,有状态地址配置方案无法应用到无线网络中。在无状态地址配置方案中,每个被分配的地址都需要在整个网络中进行重复地址检测以确保它的唯一性,导致了大量的控制包开销,消耗了大量的网络资源,因此也不适用于无线网络使用。The current address configuration is divided into two forms: stateful address configuration and stateless address configuration. The stateful address configuration scheme uses the server/client communication method to assign addresses, that is, the node requests the server to apply for an address, and then the server unifies the network The nodes within are assigned addresses. Since the mobile ad hoc network does not have any infrastructure, such as a server, the stateful address configuration scheme cannot be applied to a wireless network. In the stateless address configuration scheme, each assigned address needs to perform duplicate address detection in the entire network to ensure its uniqueness, resulting in a large amount of control packet overhead and consuming a large amount of network resources, so it is not applicable for wireless network use.

因此针对无线网络需要建立一种低开销的地址自动配置方案。Therefore, it is necessary to establish a low-overhead address automatic configuration scheme for wireless networks.

发明内容Contents of the invention

发明目的:本发明所要解决的技术问题是针对现有技术的不足,提供一种无线网络的通信实现方法。Purpose of the invention: The technical problem to be solved by the present invention is to provide a wireless network communication implementation method for the deficiencies of the prior art.

技术方案:本发明公开了一种无线网络的通信实现方法,所述无线网络的活动区域由2n1×2n2个二维的正方形网格构成,n1和n2为正整数,边长为r为移动节点的传输半径,每个网格的坐标为(x,y),x<2n1,y<2n2,x和y为非负整数;移动节点通过GPS技术获取自己的地理坐标(Gx,Gy),然后根据公式(1)和(2)获取其所在网格的坐标(x,y);Technical solution: The present invention discloses a method for implementing wireless network communication. The active area of the wireless network is composed of 2 n1 × 2 n2 two-dimensional square grids, n1 and n2 are positive integers, and the side length is r is the transmission radius of the mobile node, the coordinates of each grid are (x, y), x<2 n1 , y<2 n2 , x and y are non-negative integers; the mobile node obtains its own geographic coordinates through GPS technology ( Gx, Gy), and then obtain the coordinates (x, y) of the grid where it is located according to formulas (1) and (2);

无线网络的分裂与合并过程都在活动区域内进行;The splitting and merging process of the wireless network is carried out in the active area;

无线网络包括两类节点:新节点和已配置节点,新节点为没有获取IPv6地址的节点;已配置节点为已经获取IPv6地址的节点,已配置节点保存一个分配变量,用以记录当前所在无线网络的地址配置情况;The wireless network includes two types of nodes: new nodes and configured nodes. New nodes are nodes that have not obtained IPv6 addresses; configured nodes are nodes that have obtained IPv6 addresses. Configured nodes save a distribution variable to record the current wireless network address configuration;

无线网络中节点的IPv6地址由三部分组成,第一部分是网络前缀,网络前缀由随机函数随机产生,一个无线网络中所有节点的IPv6地址的网络前缀都相同;第二部分为节点类型,长度为1比特,该值为1时,表明是已配置节点,该值为0时,表明为新节点;第三部分为节点ID,长度为i比特,它在一个无线网络内具有唯一性,唯一标识一个已配置节点;The IPv6 address of a node in a wireless network consists of three parts. The first part is the network prefix, which is randomly generated by a random function. The network prefixes of the IPv6 addresses of all nodes in a wireless network are the same; the second part is the node type, and the length is 1 bit, when the value is 1, it indicates that it is a configured node, when the value is 0, it indicates that it is a new node; the third part is the node ID, the length is i bits, it is unique in a wireless network, unique identification a configured node;

每个已配置节点保存一个分配变量,该变量的长度为2i-2,即不包括0和2i-1,i为大于1且小于127的正整数,每个比特位唯一对应一个节点ID,从左到右依次递增1,每个比特位的值表示相应节点ID是否被分配,1代表已分配,0代表未分配;Each configured node saves an allocation variable, the length of which is 2 i -2, excluding 0 and 2 i -1, i is a positive integer greater than 1 and less than 127, each bit uniquely corresponds to a node ID , increasing by 1 from left to right, the value of each bit indicates whether the corresponding node ID is allocated, 1 means allocated, 0 means unallocated;

分配变量采用下表形式:Assignment variables take the form of the following table:

2i-22 i -2 ……... 33 22 11 00 ……... 00 11 00

例如,当i为3时,分配变量长度为6,如下表所示,按照从右到左的顺序,每个比特位分别代表的节点ID值为1,2,3,4,5,6,每个比特位的值分配代表这些节点ID值是否被分配,从表中可以看出,节点ID2和5已分配,其余节点ID未分配;一个无线网络中,每个已配置节点的分配变量值都相同,即反应整个无线网络的地址配置情况;For example, when i is 3, the assigned variable length is 6, as shown in the table below, in order from right to left, the node ID values represented by each bit are 1, 2, 3, 4, 5, 6, The value assignment of each bit represents whether these node ID values are assigned. It can be seen from the table that node IDs 2 and 5 have been assigned, and the remaining node IDs have not been assigned; in a wireless network, the assigned variable value of each configured node They are all the same, that is, they reflect the address configuration of the entire wireless network;

分配变量assign variables

Node ID:6Node ID: 6 55 44 33 22 11 00 11 00 00 11 00

每个无线网络具有一个唯一的网络ID来标识,网络ID由哈希函数来构建,哈希函数的输入参数为网络前缀和分配变量,一个无线网络中的已配置节点的网络ID都相同;由于一个无线网络中所有已配置节点的网络前缀和分配变量都相同,因此网络ID也相同;Each wireless network has a unique network ID to identify. The network ID is constructed by a hash function. The input parameters of the hash function are the network prefix and the distribution variable. The network IDs of the configured nodes in a wireless network are the same; because All configured nodes in a wireless network have the same network prefix and assigned variables, and therefore the same network ID;

节点ID的地址分配空间为2i-2,均分分布于2n1×2n2个二维正方形网格中,网格坐标为(x,y)的节点ID空间长度S(x,y)如公式(3)所示,节点ID区间为[P(x,y),E(x,y)],P(x,y)和E(x,y)的计算如公式(4)和(5)所示;The address allocation space of the node ID is 2 i -2, which is evenly distributed in 2 n1 × 2 n2 two-dimensional square grids. The node ID space length S(x, y) with grid coordinates (x, y) is as follows: As shown in formula (3), the node ID interval is [P(x,y), E(x,y)], and the calculation of P(x,y) and E(x,y) is as in formulas (4) and (5 );

每个节点广播或单播信标帧来实现地址配置和通信,信标帧负载的前四个比特代表信标帧的类型,不同类型的信标帧,其负载内容也不同;Each node broadcasts or unicasts a beacon frame to implement address configuration and communication. The first four bits of the beacon frame load represent the type of the beacon frame. Different types of beacon frames have different load contents;

0000类型信标帧:该类型信标帧在无线网络内广播,负载为广播该信标帧的节点所在网格的坐标;0000 type beacon frame: this type of beacon frame is broadcast in the wireless network, and the payload is the coordinates of the grid where the node broadcasting the beacon frame is located;

0001类型信标帧:该类型信标帧在网格内广播,负载为广播该信标帧的节点分配变量中对应所在网格的节点ID区间的比特值;0001 type beacon frame: This type of beacon frame is broadcast in the grid, and the load is the bit value of the node ID interval corresponding to the node ID interval in the node that broadcasts the beacon frame;

0010类型信标帧:该类型信标帧在无线网络内单播或者广播,负载为广播该信标帧的节点所在网格的坐标以及分配变量中对应所在网格的节点ID区间的比特值;0010 type beacon frame: This type of beacon frame is unicast or broadcast in the wireless network, and the payload is the coordinates of the grid where the node broadcasting the beacon frame is located and the bit value of the node ID interval corresponding to the grid where the node is located in the allocation variable;

0011类型信标帧:该类型信标帧在网格内单播,负载为空;0011 type beacon frame: this type of beacon frame is unicast in the grid, and the payload is empty;

0100类型信标帧:该类型信标帧在无线网络内单播,负载为广播该信标帧的节点的分配变量值;0100 type beacon frame: This type of beacon frame is unicast in the wireless network, and the payload is the assigned variable value of the node that broadcasts the beacon frame;

0101类型信标帧:该类型信标帧在网格内广播,其负载为网络ID、已分配地址数量以及广播该信标帧的节点的分配变量中对应所在网格的节点ID区间的比特值;0101 type beacon frame: This type of beacon frame is broadcast in the grid, and its load is the network ID, the number of allocated addresses, and the bit value corresponding to the node ID interval of the grid in the allocation variable of the node broadcasting the beacon frame ;

0110类型信标帧:该类型信标帧在无线网络内单播,负载为新分配的节点ID;0110 type beacon frame: this type of beacon frame is unicast in the wireless network, and the payload is the newly allocated node ID;

0111类型信标帧:该类型信标帧在无线网络内广播,消息负载为分配变量和网络前缀,其中网络前缀为可选项;0111 type beacon frame: This type of beacon frame is broadcast in the wireless network, and the message load is the allocation variable and the network prefix, where the network prefix is optional;

1000类型信标帧:该类型信标帧在无线网络内单播或者广播,负载为空;1000 type beacon frame: This type of beacon frame is unicast or broadcast in the wireless network, and the payload is empty;

1001类型信标帧:该类型信标帧在无线网络内单播,消息负载为空,用于确认目的节点是否失效或者离开;1001 type beacon frame: this type of beacon frame is unicast in the wireless network, the message load is empty, and is used to confirm whether the destination node fails or leaves;

1010类型信标帧:该类型信标帧在无线网络内单播,消息负载为空,该消息是1001类型信标帧的响应帧;1010 type beacon frame: this type of beacon frame is unicast in the wireless network, the message load is empty, and the message is the response frame of the 1001 type beacon frame;

本发明提出了无线网络体系结构以及相应的地址结构,同时采用网络ID唯一标识一个无线网络从而有效判断网络合并的发生。基于无线网络体系结构以及地址结构,本发明利用现有的信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,此外,节点的地址配置并行进行,从而有效降低了地址配置代价和延迟。The invention proposes a wireless network system structure and a corresponding address structure, and at the same time uses a network ID to uniquely identify a wireless network so as to effectively judge the occurrence of network merging. Based on the wireless network architecture and address structure, the present invention utilizes the existing beacon frame to implement address configuration, and the node performs address configuration according to the allocation variable and can obtain a unique address without information interaction with other nodes. In addition, the node Address configuration is performed in parallel, which effectively reduces the cost and delay of address configuration.

本发明所述方法中,如果节点Z1所在网格的坐标为(x1,y1),节点Z2所在网络的坐标为(x2,y2),那么网格坐标值的比较算法如下所示:In the method of the present invention, if the coordinates of the grid where the node Z1 is located are (x1, y1), and the coordinates of the network where the node Z2 is located are (x2, y2), then the comparison algorithm of the grid coordinate values is as follows:

1)如果x1<x2,那么Z1所在网格的坐标值小于Z2所在网格的坐标值;如果x1>x2,那么Z1所在网格的坐标值大于Z2所在网格的坐标值;1) If x1<x2, then the coordinate value of the grid where Z1 is located is smaller than the coordinate value of the grid where Z2 is located; if x1>x2, then the coordinate value of the grid where Z1 is located is greater than the coordinate value of the grid where Z2 is located;

2)如果x1=x2且y1<y2,那么Z1所在网格的坐标值小于Z2所在网格的坐标值;如果x1=x2且y1>y2,那么Z1所在网格的坐标值大于Z2所在网格的坐标值;2) If x1=x2 and y1<y2, then the coordinate value of the grid where Z1 is located is smaller than the coordinate value of the grid where Z2 is located; if x1=x2 and y1>y2, then the coordinate value of the grid where Z1 is located is greater than the grid where Z2 is located coordinate value;

3)如果x1=x2且y1=y2,那么Z1和Z2在同一个网格内;3) If x1=x2 and y1=y2, then Z1 and Z2 are in the same grid;

在初始状态,所有节点均为新节点;新节点通过网格初始化和节点地址初始化实现地址配置;In the initial state, all nodes are new nodes; new nodes implement address configuration through grid initialization and node address initialization;

新节点首先获取自己的地理坐标并根据公式(1)和(2)获取所在网格的坐标(x,y),然后采用随机函数产生一个网络前缀,同时从所在网格节点ID区间[P(x,y),E(x,y)]中随机选取一个节点ID,将网络前缀与节点ID形成一个临时地址,其中节点类型为0;在新节点获取IPv6地址之前,由临时地址唯一标识;The new node first obtains its own geographic coordinates and obtains the coordinates (x, y) of the grid according to formulas (1) and (2), then uses a random function to generate a network prefix, and at the same time obtains the grid node ID interval [P( Randomly select a node ID from x, y), E(x, y)], and form a temporary address with the network prefix and node ID, where the node type is 0; before the new node obtains an IPv6 address, it is uniquely identified by the temporary address;

新节点获取临时地址后,开始广播0000类型信标帧,消息源地址为其临时地址,消息负载为所在网格的坐标值;After the new node obtains the temporary address, it starts to broadcast the 0000 type beacon frame, the message source address is its temporary address, and the message load is the coordinate value of the grid where it is located;

新节点在等待规定时间后判断是否满足下述条件之一:The new node judges whether one of the following conditions is met after waiting for the specified time:

条件1,新节点没有收到任何一个信标帧;Condition 1, the new node does not receive any beacon frame;

条件2,新节点收到的信标帧的源节点均为新节点,与这些信标帧的源节点所在网格的坐标值相比,它自己所在网格的坐标值最小,且在自己网格内发送的信标帧的时间戳最早;Condition 2, the source nodes of the beacon frames received by the new node are all new nodes, and compared with the coordinate values of the grid where the source nodes of these beacon frames are located, the coordinate value of the grid where it is located is the smallest, and it is in its own network. The timestamp of the beacon frame sent in the grid is the earliest;

假设节点发送两个信标帧的间隔时间为t,那么规定时间为a·t,其中,a为正整数,例如,当t为100ms,a为5时,规定时间为500ms;Assuming that the interval between sending two beacon frames by a node is t, the specified time is a t, where a is a positive integer, for example, when t is 100ms and a is 5, the specified time is 500ms;

如果一个新节点X满足上述条件之一,它则将自己标记为已配置节点,将自己的IPv6地址的网络前缀和节点ID设置为临时地址的网路前缀和节点ID,节点类型为1,同时构建分配变量,将自己节点ID相对应的比特位值设置为1;If a new node X satisfies one of the above conditions, it will mark itself as a configured node, set the network prefix and node ID of its own IPv6 address as the network prefix and node ID of the temporary address, and set the node type to 1, while Build an allocation variable, and set the bit value corresponding to its own node ID to 1;

网格初始化:位于不同网格的新节点收到已配置节点的信标帧后,将已配置节点的网络前缀设置为自己的网络前缀;如果新节点发送的信标帧在本网格内时间戳最早,那么它将自己标记为已配置节点,并将网络前缀与自己临时地址的节点ID相结合产生一个IPv6地址,节点类型为1,同时构建分配变量,将自己节点ID相对应的比特位值设置为1;Grid initialization: After a new node in a different grid receives the beacon frame of the configured node, it sets the network prefix of the configured node as its own network prefix; if the beacon frame sent by the new node is within the grid time stamp the earliest, then it will mark itself as a configured node, and combine the network prefix with the node ID of its temporary address to generate an IPv6 address, the node type is 1, and at the same time build an allocation variable, and set the bit corresponding to its own node ID value is set to 1;

重复上述网格初始化过程,直到每个网格内发送信标帧时间戳最早的新节点获取IPv6地址并转换为已配置节点;Repeat the above grid initialization process until the new node with the earliest timestamp of sending the beacon frame in each grid obtains an IPv6 address and converts it into a configured node;

在一个网格内,第一个已配置节点获取IPv6地址后,它广播一个0001类型信标帧,消息负载为分配变量中对应所在网格的节点ID区间的比特值;In a grid, after the first configured node obtains an IPv6 address, it broadcasts a 0001-type beacon frame, and the message load is the bit value of the node ID range corresponding to the grid in the assigned variable;

节点地址初始化:同一个网格内的已配置节点和新节点收到0001类型信标帧后,根据信标帧负载内容更新自己的分配变量;同一个网格内的新节点收到类型为0001类型信标帧后,从本网格对应的节点ID区间中随机选取一个未分配的节点ID,并将分配变量中相应比特位设置1,然后广播0001类型信标帧;Node address initialization: After the configured nodes and new nodes in the same grid receive the 0001 type beacon frame, they update their allocation variables according to the load content of the beacon frame; the new node in the same grid receives the type 0001 After the type beacon frame, randomly select an unassigned node ID from the node ID interval corresponding to this grid, and set the corresponding bit in the allocation variable to 1, and then broadcast the 0001 type beacon frame;

同一个网格内的新节点重复上述节点地址初始化过程,直到本网格内所有新节点都获取IPv6地址并变成已配置节点;New nodes in the same grid repeat the above node address initialization process until all new nodes in this grid obtain IPv6 addresses and become configured nodes;

一个网格内所有新节点获取IPv6地址后,第一个已配置节点Y广播一个0010类型信标帧,消息负载为节点Y所在网格的坐标以及分配变量中对应所在网格的节点ID区间的比特值;该信标帧在网络内广播,每个收到该信标帧的已配置节点和新节点用负载中的比特值更新自己的分配变量中对应该网格的节点ID区间的比特值;After all new nodes in a grid obtain IPv6 addresses, the first configured node Y broadcasts a 0010-type beacon frame, and the message load is the coordinates of the grid where node Y is located and the node ID range corresponding to the grid where node Y is located in the allocation variable. Bit value; the beacon frame is broadcast in the network, and each configured node and new node that receives the beacon frame updates the bit value corresponding to the node ID interval of the grid in its allocation variable with the bit value in the load ;

网络内所有新节点获取IPv6地址后,它们的分配变量都相同,然后利用网络前缀和分配变量获取网络ID。After all new nodes in the network obtain IPv6 addresses, their distribution variables are the same, and then use the network prefix and distribution variables to obtain the network ID.

本发明利用现有的信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,此外,节点的地址配置并行进行,从而有效降低了地址配置代价和延迟。The present invention utilizes the existing beacon frame to realize address configuration, the node performs address configuration according to the allocation variable and can obtain a unique address without information interaction with other nodes, in addition, the node address configuration is performed in parallel, thereby effectively reducing the address configuration costs and delays.

本发明所述方法中,已配置节点获取网络ID,开始定期广播0101类型信标帧;In the method of the present invention, the configured node obtains the network ID, and begins to periodically broadcast 0101 type beacon frames;

新节点加入网络后,首先获取自己的地理坐标并获取所在网格的坐标,同时侦听来自相同网格内的邻居已配置节点的0101类型信标帧;After the new node joins the network, it first obtains its own geographic coordinates and obtains the coordinates of the grid where it is located, and at the same time listens to the 0101 type beacon frame from the neighbor configured nodes in the same grid;

新节点Z收到相同网格中的邻居已配置节点M的0101类型信标帧后,根据下述过程获取IPv6地址:After the new node Z receives the 0101 type beacon frame from the configured neighbor node M in the same grid, it obtains an IPv6 address according to the following process:

步骤101:开始;Step 101: start;

步骤102:新节点Z用信标帧中的分配变量值更新自己的分配变量,然后从本网格对应的节点ID区间中随机选取一个未分配的节点ID,将分配变量中相应比特位设置为1,将自己标记为已配置节点,然后广播0010类型信标帧,同时向已配置节点M发送类型为0011类型信标帧;Step 102: The new node Z updates its own allocation variable with the allocation variable value in the beacon frame, then randomly selects an unallocated node ID from the node ID interval corresponding to this grid, and sets the corresponding bit in the allocation variable to 1. Mark itself as a configured node, then broadcast a beacon frame of type 0010, and send a beacon frame of type 0011 to the configured node M at the same time;

步骤103:无线网络内的节点收到已配置节点Z广播的0010类型信标帧后,用消息负载更新自己的分配变量;Step 103: After the nodes in the wireless network receive the 0010 type beacon frame broadcast by the configured node Z, they update their allocation variables with the message payload;

步骤104:已配置节点M收到0011类型信标帧后,向已配置节点Z返回一个类型为0100的信标帧,消息负载为自己的分配变量;Step 104: After receiving the beacon frame of type 0011, the configured node M returns a beacon frame of type 0100 to the configured node Z, and the message load is its assigned variable;

步骤105:已配置节点Z收到已配置节点M的信标帧后,用信标帧负载中的分配变量来更新自己除本网格以外的其他网格对应的节点ID区间的比特值;Step 105: After the configured node Z receives the beacon frame of the configured node M, it uses the allocation variable in the load of the beacon frame to update the bit value of the node ID range corresponding to other grids except this grid;

步骤106:结束。Step 106: end.

新节点加入网络后通过上述过程可以获取具有唯一性的地址,由于新节点利用现有信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,因此有效降低了地址配置代价和延迟。After the new node joins the network, the unique address can be obtained through the above process. Since the new node uses the existing beacon frame to realize the address configuration, the node configures the address according to the allocation variable and can obtain a unique address without information interaction with other nodes. Unique addresses, thus effectively reducing address configuration costs and delays.

本发明所述方法中,如果已配置节点Z检测到所在网格中节点ID区间对应的分配变量值都为1,那么它发起下述地址回收操作:In the method of the present invention, if the configured node Z detects that the distribution variable values corresponding to the node ID range in the grid where it is located are all 1, it initiates the following address recovery operation:

步骤201:开始;Step 201: start;

步骤202:已配置节点Z向在本网格内获取节点ID的每个已配置节点发送1001类型信标帧;Step 202: The configured node Z sends a 1001 type beacon frame to each configured node that obtains the node ID in the current grid;

步骤203:已配置节点收到1001类型信标帧后,向已配置节点Z返回1010类型信标帧;Step 203: After the configured node receives the 1001 type beacon frame, it returns the 1010 type beacon frame to the configured node Z;

步骤204:判断已配置节点Z是否收到在本网格内获取节点ID的已配置节点返回的1010类型信标帧,如果是,进行步骤206,否则进行步骤205;Step 204: Determine whether the configured node Z has received the 1010 type beacon frame returned by the configured node that obtained the node ID in the grid, if yes, proceed to step 206, otherwise proceed to step 205;

步骤205:已配置节点Z将为返回1010类型信标帧的节点的节点ID对应的分配变量中的比特位设置为0;Step 205: The configured node Z will set the bit in the allocation variable corresponding to the node ID of the node returning the 1010 type beacon frame to 0;

步骤206:判断已配置节点Z的分配变量是否发生变化,如果是,进行步骤207,否则进行步骤208;Step 206: Determine whether the allocation variable of the configured node Z has changed, if yes, go to step 207, otherwise go to step 208;

步骤207:已配置节点Z广播0010类型信标帧,无线网络内的已配置节点和新节点收到已配置节点Z广播的0010类型信标帧后,更新自己分配变量中的相应比特位;Step 207: The configured node Z broadcasts a 0010-type beacon frame, and after receiving the 0010-type beacon frame broadcast by the configured node Z, the configured nodes and new nodes in the wireless network update the corresponding bits in their assigned variables;

步骤208:结束。Step 208: end.

节点通过上述过程回收地址资源从而确保有足够的地址资源可供分配,增加了地址配置成功率。由于节点利用现有信标帧实现了地址回收,因此有效降低了地址回收代价和延迟。The node reclaims address resources through the above process to ensure that there are enough address resources available for allocation, increasing the success rate of address configuration. Since the node utilizes the existing beacon frame to implement address recovery, the cost and delay of address recovery are effectively reduced.

本发明所述方法中,当以下两种条件之一发生时,判定为两个网络合并:In the method of the present invention, when one of the following two conditions occurs, it is determined that the two networks are merged:

条件1,已配置节点X与已配置节点Y的网络ID不一致,包括两种子条件,两种子条件只要满足其一即为满足条件1:Condition 1, the network IDs of configured node X and configured node Y are inconsistent, including two sub-conditions, as long as one of the two sub-conditions is satisfied, condition 1 is satisfied:

子条件1,已配置节点X的网络前缀与已配置节点Y的网络前缀不同;Sub-condition 1, the network prefix of configured node X is different from the network prefix of configured node Y;

子条件2,已配置节点X的网络前缀与已配置节点Y的网络前缀相同,但是已配置节点X的分配变量和已配置节点Y的分配变量不同;Sub-condition 2, the network prefix of the configured node X is the same as the network prefix of the configured node Y, but the allocation variable of the configured node X is different from the allocation variable of the configured node Y;

条件2,已配置节点X与已配置节点Y的网络ID相同且已配置节点X与已配置节点Y的地址相同;Condition 2, configured node X and configured node Y have the same network ID and configured node X and configured node Y have the same address;

如果已配置节点X位于无线网络1中,已配置节点Y位于无线网络2中,已配置节点X收到已配置节点Y的0101类型信标帧后,且已配置节点X检测到已配置节点Y的网络ID与自己的网络ID不同,且无线网络1已配置地址数小于无线网络2中已配置地址数,那么已配置节点X发起下述合并操作:If configured node X is located in wireless network 1 and configured node Y is located in wireless network 2, configured node X receives configured node Y's 0101 type beacon frame, and configured node X detects configured node Y The network ID of the node X is different from its own network ID, and the number of configured addresses in wireless network 1 is less than the number of configured addresses in wireless network 2, then the configured node X initiates the following merge operation:

步骤301:开始;Step 301: start;

步骤302:已配置节点X向已配置节点Y发送0011类型信标帧,已配置节点Y收到该0011类型信标帧后,向已配置节点X返回一个0100类型信标帧,0100类型信标帧负载为已配置节点Y的分配变量;Step 302: The configured node X sends a 0011 type beacon frame to the configured node Y, and after the configured node Y receives the 0011 type beacon frame, it returns a 0100 type beacon frame to the configured node X, and the 0100 type beacon frame The frame load is the allocation variable of the configured node Y;

步骤303:已配置节点X比较自己的分配变量以及已配置节点Y的分配变量的每个比特位;Step 303: The configured node X compares its own allocation variable with each bit of the allocation variable of the configured node Y;

步骤304:判断已配置节点X是否与无线网络2中的已配置节点具有重复的节点ID,如果是,进行步骤305,否则进行步骤306;Step 304: judging whether the configured node X has the same node ID as the configured node in the wireless network 2, if yes, proceed to step 305, otherwise proceed to step 306;

步骤305:已配置节点X为自己分配一个在无线网络1和无线网络2中都未分配的节点ID,并将自己的分配变量中相应的比特位设置为1;Step 305: The configured node X assigns itself a node ID that is not assigned in both wireless network 1 and wireless network 2, and sets the corresponding bit in its own allocation variable to 1;

步骤306:已配置节点X为无线网络1中每个具有重复节点ID的已配置节点分配一个在无线网络1和无线网络2中都未分配的节点ID,并将自己的分配变量中相应的比特位设置为1,最后向每个具有重复节点ID的已配置节点发送一个0110类型信标帧,消息负载为分配的节点ID;Step 306: Configured node X allocates a node ID that is not allocated in both wireless network 1 and wireless network 2 to each configured node in wireless network 1 with a repeated node ID, and assigns the corresponding bit in its own allocation variable bit is set to 1, and finally a 0110 type beacon frame is sent to each configured node with a duplicate node ID, with the message payload being the assigned node ID;

步骤307:具有重复节点ID的已配置节点收到0110类型信标帧后,更新自己的地址,即将原来地址的节点ID设置为消息负载中的节点ID;Step 307: After receiving the 0110-type beacon frame, the configured node with the repeated node ID updates its own address, that is, the node ID of the original address is set as the node ID in the message payload;

步骤308:已配置节点X广播0111类型信标帧,消息负载为无线网络2的网络前缀以及自己的分配变量和已配置节点Y的信标变量的或操作值;Step 308: The configured node X broadcasts a 0111 type beacon frame, and the message load is the network prefix of the wireless network 2 and its own allocation variable and the OR operation value of the configured node Y's beacon variable;

步骤309:无线网络1中的节点收到0111类型信标帧后,将自己IPv6地址中的网络前缀更新为信标帧中的网络前缀,同时将自己的分配变量值设置为信标帧中的分配变量值,无线网络2中的节点收到0111类型信标帧后,将自己的分配变量设置为信标帧中的分配变量值,地址保持不变;Step 309: After receiving the 0111-type beacon frame, the nodes in wireless network 1 update the network prefix in their IPv6 address to the network prefix in the beacon frame, and set their assigned variable values to the network prefix in the beacon frame at the same time. Assign the variable value, after the node in the wireless network 2 receives the 0111 type beacon frame, set its own assigned variable as the assigned variable value in the beacon frame, and the address remains unchanged;

步骤310:结束;Step 310: end;

假设已配置节点X位于无线网络1中,已配置节点Y位于无线网络2中,已配置节点X收到已配置节点Y的0101类型信标帧后,检测到已配置节点Y的网络ID与自己的网络ID不同但是网络前缀相同,如果无线网络1中已配置地址数小于无线网络2中的已配置地址数,那么已配置节点X发起下述合并操作:Assume that configured node X is located in wireless network 1, and configured node Y is located in wireless network 2. After receiving configured node Y's 0101 beacon frame, configured node X detects that the configured node Y's network ID is the same as its own different network IDs but the same network prefix, if the number of configured addresses in wireless network 1 is less than the number of configured addresses in wireless network 2, the configured node X initiates the following merge operation:

步骤401:开始;Step 401: start;

步骤402:已配置节点X向已配置节点Y发送0011类型信标帧;Step 402: The configured node X sends a 0011 type beacon frame to the configured node Y;

步骤403:已配置节点Y收到该信标帧后,向已配置节点X返回一个0100类型信标帧,0100类型信标帧的负载为已配置节点Y的分配变量;Step 403: After the configured node Y receives the beacon frame, it returns a 0100 type beacon frame to the configured node X, and the load of the 0100 type beacon frame is the allocated variable of the configured node Y;

步骤404:已配置节点X广播类型0111类型信标帧,负载为自己的分配变量和已配置节点Y的分配变量的或操作值;Step 404: The configured node X broadcasts a beacon frame of type 0111, and the payload is the or operation value of its own allocation variable and the allocation variable of the configured node Y;

步骤405:无线网络1和无线网络2中的节点收到0111类型信标帧后,将自己的分配变量设置为信标帧中的分配变量值,地址保持不变;Step 405: After receiving the 0111-type beacon frame, the nodes in wireless network 1 and wireless network 2 set their own allocation variable as the value of the allocation variable in the beacon frame, and the address remains unchanged;

步骤406:已配置节点X比较自己的分配变量以及已配置节点Y的分配变量的每个比特位,向两个网络中每个具有重复节点ID的已配置节点发送1000类型信标帧;Step 406: The configured node X compares its own allocation variable with each bit of the allocation variable of the configured node Y, and sends a 1000-type beacon frame to each configured node with a duplicate node ID in the two networks;

步骤407:具有重复节点ID的已配置节点收到1000类型信标帧后,将自己标记为新节点,执行步骤101到步骤106重新获取地址;Step 407: After receiving the 1000-type beacon frame, the configured node with the duplicate node ID marks itself as a new node, and performs steps 101 to 106 to obtain the address again;

步骤408:结束;Step 408: end;

如果已配置节点X检测到它与已配置节点Y的网络ID和地址都相同,那么已配置节点X广播1000类型信标帧,无线网络1和无线网络2中的节点收到该1000类型信标帧后,将自己标记为新节点,然后重新执行网络初始化;If configured node X detects that it has the same network ID and address as configured node Y, then configured node X broadcasts a 1000 type beacon frame, and nodes in wireless network 1 and wireless network 2 receive the 1000 type beacon After the frame, mark itself as a new node, and then re-execute the network initialization;

如果一部分节点从网络分裂出来,由于这些分裂出来的节点的IPv6地址具有唯一性,因此无需做任何操作即可保证地址的唯一性。If some nodes are split from the network, since the IPv6 addresses of these split nodes are unique, the uniqueness of the addresses can be guaranteed without any operation.

在上述网络合并过程中,本发明利用网络ID可有效判断网络合并的发生,此外网络合并采用信标帧来实现,从而降低了网络合并代价和延迟;在网络合并过程中,根据分配变量只需对具有重复地址的节点进行重新进行地址配置,从而进一步降低了网络合并代价和延迟。In the above-mentioned network merging process, the present invention utilizes the network ID to effectively determine the occurrence of network merging. In addition, the network merging is implemented using beacon frames, thereby reducing the network merging cost and delay; in the network merging process, only Re-configure addresses for nodes with duplicate addresses, further reducing network merging costs and delays.

有益效果:本发明提供了一种无线网络的通信实现方法,由于无线网络节点同时具有主机和路由器两个身份,因此导致无线网络体系结构和传统网络体系结构不同,所以目前传统网络中的IPv6地址配置方案无法应用到移动自组网络中,迫切需要一种适合无线网络使用的地址配置方案。本发明利用现有的信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,此外,节点的地址配置并行进行,从而有效降低了地址配置代价和延迟。在网络合并过程中,本发明利用网络ID可有效判断网络合并的发生,此外网络合并采用信标帧来实现,从而降低了网络合并代价和延迟;在网络合并过程中,根据分配变量只需对具有重复地址的节点进行重新进行地址配置,从而进一步降低了网络合并代价和延迟。所述无线网络中的节点通过本发明所提供的通信实现方法,可拥有具有网络唯一性的IPv6地址,从而实现正确的通信。本发明可应用于交通路况检控及农业工程化等诸多领域,具有广泛的应用前景。Beneficial effects: the present invention provides a communication implementation method of a wireless network. Since a wireless network node has two identities of a host and a router at the same time, the structure of the wireless network is different from that of the traditional network. Therefore, the IPv6 address in the current traditional network The configuration scheme cannot be applied to the mobile ad hoc network, and an address configuration scheme suitable for wireless networks is urgently needed. The present invention utilizes the existing beacon frame to realize the address configuration, the node configures the address according to the allocation variable and can obtain a unique address without information interaction with other nodes, in addition, the address configuration of the node is carried out in parallel, thereby effectively reducing the address configuration costs and delays. In the process of network merging, the present invention can effectively judge the occurrence of network merging by using the network ID. In addition, network merging is realized by using beacon frames, thereby reducing the cost and delay of network merging; in the process of network merging, only the Nodes with duplicate addresses are reconfigured to further reduce network merging costs and delays. The nodes in the wireless network can have network-unique IPv6 addresses through the communication realization method provided by the present invention, so as to realize correct communication. The invention can be applied to many fields such as traffic road condition inspection and control, agricultural engineering, etc., and has wide application prospects.

附图说明Description of drawings

下面结合附图和具体实施方式对本发明做更进一步的具体说明,本发明的上述和/或其他方面的优点将会变得更加清楚。The advantages of the above and/or other aspects of the present invention will become clearer as the present invention will be further described in detail in conjunction with the accompanying drawings and specific embodiments.

图1为本发明所述的无线网络拓扑结构示意图。FIG. 1 is a schematic diagram of a wireless network topology according to the present invention.

图2为本发明所述IPv6地址结构示意图。Fig. 2 is a schematic diagram of the IPv6 address structure of the present invention.

图3为本发明所述新节点获取地址的流程示意图。Fig. 3 is a schematic flow chart of the new node obtaining an address according to the present invention.

图4为本发明所述地址回收流程示意图。FIG. 4 is a schematic diagram of an address reclamation process according to the present invention.

图5为本发明所述条件1的网络合并流程示意图。FIG. 5 is a schematic diagram of a network merging process under condition 1 of the present invention.

图6为本发明所述条件2的网络合并流程示意图。Fig. 6 is a schematic diagram of the network merging process under condition 2 of the present invention.

具体实施方式:detailed description:

本发明提供了一种无线网络的通信实现方法,在所述方法中,无线网络中的每个节点可获取具有网络唯一性的IPv6地址,实现正确的通信。The invention provides a method for implementing wireless network communication. In the method, each node in the wireless network can acquire an IPv6 address with network uniqueness to realize correct communication.

图1为本发明所述的无线网络拓扑结构示意图。所述无线网络的活动区域由2n1×2n2个二维的正方形网格1构成,n1和n2为正整数,边长为r为移动节点的传输半径,每个网格的坐标为(x,y),x<2n1,y<2n2,x和y为非负整数;移动节点通过GPS技术获取自己的地理坐标(Gx,Gy),然后根据公式(1)和(2)获取其所在网格的坐标(x,y);FIG. 1 is a schematic diagram of a wireless network topology according to the present invention. The active area of the wireless network is composed of 2 n1 × 2 n2 two-dimensional square grids 1, n1 and n2 are positive integers, and the side length is r is the transmission radius of the mobile node, the coordinates of each grid are (x, y), x<2 n1 , y<2 n2 , x and y are non-negative integers; the mobile node obtains its own geographic coordinates through GPS technology ( Gx, Gy), and then obtain the coordinates (x, y) of the grid where it is located according to formulas (1) and (2);

无线网络的分裂与合并过程都在活动区域内进行;The splitting and merging process of the wireless network is carried out in the active area;

无线网络包括两类节点:新节点2和已配置节点3,新节点2为没有获取IPv6地址的节点;已配置节点3为已经获取IPv6地址的节点,已配置节点3保存一个分配变量,用以记录当前所在无线网络的地址配置情况。The wireless network includes two types of nodes: the new node 2 and the configured node 3, the new node 2 is a node that has not obtained an IPv6 address; the configured node 3 is a node that has obtained an IPv6 address, and the configured node 3 saves a distribution variable for Record the address configuration of the current wireless network.

图2为本发明所述IPv6地址结构示意图。无线网络中节点的IPv6地址由三部分组成,第一部分是网络前缀,网络前缀由随机函数随机产生,一个无线网络中所有节点的IPv6地址的网络前缀都相同;第二部分为节点类型,长度为1比特,该值为1时,表明是已配置节点,该值为0时,表明为新节点;第三部分为节点ID,长度为i比特,它在一个无线网络内具有唯一性,唯一标识一个已配置节点;Fig. 2 is a schematic diagram of the IPv6 address structure of the present invention. The IPv6 address of a node in a wireless network consists of three parts. The first part is the network prefix, which is randomly generated by a random function. The network prefixes of the IPv6 addresses of all nodes in a wireless network are the same; the second part is the node type, and the length is 1 bit, when the value is 1, it indicates that it is a configured node, when the value is 0, it indicates that it is a new node; the third part is the node ID, the length is i bits, it is unique in a wireless network, unique identification a configured node;

每个已配置节点保存一个分配变量,该变量的长度为2i-2,即不包括0和2i-1,i为大于1且小于127的正整数,每个比特位唯一对应一个节点ID,从左到右依次递增1,每个比特位的值表示相应节点ID是否被分配,1代表已分配,0代表未分配;Each configured node saves an allocation variable, the length of which is 2 i -2, excluding 0 and 2 i -1, i is a positive integer greater than 1 and less than 127, each bit uniquely corresponds to a node ID , increasing by 1 from left to right, the value of each bit indicates whether the corresponding node ID is allocated, 1 means allocated, 0 means unallocated;

分配变量采用下表形式:Assignment variables take the form of the following table:

2i-22 i -2 ……... 33 22 11 00 ……... 00 11 00

例如,当i为3时,分配变量长度为6,如下表所示,按照从右到左的顺序,每个比特位分别代表的节点ID值为1,2,3,4,5,6,每个比特位的值分配代表这些节点ID值是否被分配,从表中可以看出,节点ID2和5已分配,其余节点ID未分配;一个无线网络中,每个已配置节点的分配变量值都相同,即反应整个无线网络的地址配置情况;For example, when i is 3, the assigned variable length is 6, as shown in the table below, in order from right to left, the node ID values represented by each bit are 1, 2, 3, 4, 5, 6, The value assignment of each bit represents whether these node ID values are assigned. It can be seen from the table that node IDs 2 and 5 have been assigned, and the remaining node IDs have not been assigned; in a wireless network, the assigned variable value of each configured node They are all the same, that is, they reflect the address configuration of the entire wireless network;

分配变量assign variable

Node ID:6Node ID: 6 55 44 33 22 11 00 11 00 00 11 00

每个无线网络具有一个唯一的网络ID来标识,网络ID由哈希函数来构建,哈希函数的输入参数为网络前缀和分配变量,一个无线网络中的已配置节点的网络ID都相同;由于一个无线网络中所有已配置节点的网络前缀和分配变量都相同,因此网络ID也相同;Each wireless network has a unique network ID to identify. The network ID is constructed by a hash function. The input parameters of the hash function are the network prefix and the distribution variable. The network IDs of the configured nodes in a wireless network are the same; because All configured nodes in a wireless network have the same network prefix and assigned variables, and therefore the same network ID;

节点ID的地址分配空间为2i-2,均分分布于2n1×2n2个二维正方形网格中,网格坐标为(x,y)的节点ID空间长度S(x,y)如公式(3)所示,节点ID区间为[P(x,y),E(x,y)],P(x,y)和E(x,y)的计算如公式(4)和(5)所示;The address allocation space of the node ID is 2 i -2, which is evenly distributed in 2 n1 × 2 n2 two-dimensional square grids. The node ID space length S(x, y) with grid coordinates (x, y) is as follows: As shown in formula (3), the node ID interval is [P(x,y), E(x,y)], and the calculation of P(x,y) and E(x,y) is as in formulas (4) and (5 );

每个节点广播或单播信标帧来实现地址配置和通信,信标帧负载的前四个比特代表信标帧的类型,不同类型的信标帧,其负载内容也不同;Each node broadcasts or unicasts a beacon frame to implement address configuration and communication. The first four bits of the beacon frame load represent the type of the beacon frame. Different types of beacon frames have different load contents;

0000类型信标帧:该类型信标帧在无线网络内广播,负载为广播该信标帧的节点所在网格的坐标;0000 type beacon frame: this type of beacon frame is broadcast in the wireless network, and the payload is the coordinates of the grid where the node broadcasting the beacon frame is located;

0001类型信标帧:该类型信标帧在网格内广播,负载为广播该信标帧的节点分配变量中对应所在网格的节点ID区间的比特值;0001 type beacon frame: This type of beacon frame is broadcast in the grid, and the load is the bit value of the node ID interval corresponding to the node ID interval in the node that broadcasts the beacon frame;

0010类型信标帧:该类型信标帧在无线网络内单播或者广播,负载为广播该信标帧的节点所在网格的坐标以及分配变量中对应所在网格的节点ID区间的比特值;0010 type beacon frame: This type of beacon frame is unicast or broadcast in the wireless network, and the payload is the coordinates of the grid where the node broadcasting the beacon frame is located and the bit value of the node ID interval corresponding to the grid where the node is located in the allocation variable;

0011类型信标帧:该类型信标帧在网格内单播,负载为空;0011 type beacon frame: this type of beacon frame is unicast in the grid, and the payload is empty;

0100类型信标帧:该类型信标帧在无线网络内单播,负载为广播该信标帧的节点的分配变量值;0100 type beacon frame: This type of beacon frame is unicast in the wireless network, and the payload is the assigned variable value of the node that broadcasts the beacon frame;

0101类型信标帧:该类型信标帧在网格内广播,其负载为网络ID、已分配地址数量以及广播该信标帧的节点的分配变量中对应所在网格的节点ID区间的比特值;0101 type beacon frame: This type of beacon frame is broadcast in the grid, and its load is the network ID, the number of allocated addresses, and the bit value corresponding to the node ID interval of the grid in the allocation variable of the node broadcasting the beacon frame ;

0110类型信标帧:该类型信标帧在无线网络内单播,负载为新分配的节点ID;0110 type beacon frame: this type of beacon frame is unicast in the wireless network, and the payload is the newly allocated node ID;

0111类型信标帧:该类型信标帧在无线网络内广播,消息负载为分配变量和网络前缀,其中网络前缀为可选项;0111 type beacon frame: This type of beacon frame is broadcast in the wireless network, and the message load is the allocation variable and the network prefix, where the network prefix is optional;

1000类型信标帧:该类型信标帧在无线网络内单播或者广播,负载为空;1000 type beacon frame: This type of beacon frame is unicast or broadcast in the wireless network, and the payload is empty;

1001类型信标帧:该类型信标帧在无线网络内单播,消息负载为空,用于确认目的节点是否失效或者离开;1001 type beacon frame: this type of beacon frame is unicast in the wireless network, the message load is empty, and is used to confirm whether the destination node fails or leaves;

1010类型信标帧:该类型信标帧在无线网络内单播,消息负载为空,该消息是1001类型信标帧的响应帧。1010-type beacon frame: This type of beacon frame is unicast in the wireless network, and the message payload is empty. The message is a response frame of the 1001-type beacon frame.

本发明提出了无线网络体系结构以及相应的地址结构,同时采用网络ID唯一标识一个无线网络从而有效判断网络合并的发生。基于无线网络体系结构以及地址结构,本发明利用现有的信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,此外,节点的地址配置并行进行,从而有效降低了地址配置代价和延迟。The invention proposes a wireless network system structure and a corresponding address structure, and at the same time uses a network ID to uniquely identify a wireless network so as to effectively judge the occurrence of network merging. Based on the wireless network architecture and address structure, the present invention utilizes the existing beacon frame to implement address configuration, and the node performs address configuration according to the allocation variable and can obtain a unique address without information interaction with other nodes. In addition, the node Address configuration is performed in parallel, which effectively reduces the cost and delay of address configuration.

图3为本发明所述新节点获取地址的流程示意图。如果节点Z1所在网格的坐标为(x1,y1),节点Z2所在网络的坐标为(x2,y2),那么网格坐标值的比较算法如下所示:Fig. 3 is a schematic flow chart of the new node obtaining an address according to the present invention. If the coordinates of the grid where node Z1 is located are (x1, y1), and the coordinates of the network where node Z2 is located are (x2, y2), then the grid coordinate value comparison algorithm is as follows:

1)如果x1<x2,那么Z1所在网格的坐标值小于Z2所在网格的坐标值;如果x1>x2,那么Z1所在网格的坐标值大于Z2所在网格的坐标值;1) If x1<x2, then the coordinate value of the grid where Z1 is located is smaller than the coordinate value of the grid where Z2 is located; if x1>x2, then the coordinate value of the grid where Z1 is located is greater than the coordinate value of the grid where Z2 is located;

2)如果x1=x2且y1<y2,那么Z1所在网格的坐标值小于Z2所在网格的坐标值;如果x1=x2且y1>y2,那么Z1所在网格的坐标值大于Z2所在网格的坐标值;2) If x1=x2 and y1<y2, then the coordinate value of the grid where Z1 is located is smaller than the coordinate value of the grid where Z2 is located; if x1=x2 and y1>y2, then the coordinate value of the grid where Z1 is located is greater than the grid where Z2 is located coordinate value;

3)如果x1=x2且y1=y2,那么Z1和Z2在同一个网格内;3) If x1=x2 and y1=y2, then Z1 and Z2 are in the same grid;

在初始状态,所有节点均为新节点;新节点通过网格初始化和节点地址初始化实现地址配置;In the initial state, all nodes are new nodes; new nodes implement address configuration through grid initialization and node address initialization;

新节点首先获取自己的地理坐标并根据公式(1)和(2)获取所在网格的坐标(x,y),然后采用随机函数产生一个网络前缀,同时从所在网格节点ID区间[P(x,y),E(x,y)]中随机选取一个节点ID,将网络前缀与节点ID形成一个临时地址,其中节点类型为0;在新节点获取IPv6地址之前,由临时地址唯一标识;The new node first obtains its own geographic coordinates and obtains the coordinates (x, y) of the grid according to formulas (1) and (2), then uses a random function to generate a network prefix, and at the same time obtains the grid node ID interval [P( Randomly select a node ID from x, y), E(x, y)], and form a temporary address with the network prefix and node ID, where the node type is 0; before the new node obtains an IPv6 address, it is uniquely identified by the temporary address;

新节点获取临时地址后,开始广播0000类型信标帧,消息源地址为其临时地址,消息负载为所在网格的坐标值;After the new node obtains the temporary address, it starts to broadcast the 0000 type beacon frame, the message source address is its temporary address, and the message load is the coordinate value of the grid where it is located;

新节点在等待规定时间后判断是否满足下述条件之一:The new node judges whether one of the following conditions is met after waiting for the specified time:

条件1,新节点没有收到任何一个信标帧;Condition 1, the new node does not receive any beacon frame;

条件2,新节点收到的信标帧的源节点均为新节点,与这些信标帧的源节点所在网格的坐标值相比,它自己所在网格的坐标值最小,且在自己网格内发送的信标帧的时间戳最早;Condition 2, the source nodes of the beacon frames received by the new node are all new nodes, and compared with the coordinate values of the grid where the source nodes of these beacon frames are located, the coordinate value of the grid where it is located is the smallest, and it is in its own network. The timestamp of the beacon frame sent in the grid is the earliest;

假设节点发送两个信标帧的间隔时间为t,那么规定时间为a·t,其中,a为正整数,例如,当t为100ms,a为5时,规定时间为500ms;Assuming that the interval between sending two beacon frames by a node is t, the specified time is a t, where a is a positive integer, for example, when t is 100ms and a is 5, the specified time is 500ms;

如果一个新节点X满足上述条件之一,它则将自己标记为已配置节点,将自己的IPv6地址的网络前缀和节点ID设置为临时地址的网路前缀和节点ID,节点类型为1,同时构建分配变量,将自己节点ID相对应的比特位值设置为1;If a new node X satisfies one of the above conditions, it will mark itself as a configured node, set the network prefix and node ID of its own IPv6 address as the network prefix and node ID of the temporary address, and set the node type to 1, while Build an allocation variable, and set the bit value corresponding to its own node ID to 1;

网格初始化:位于不同网格的新节点收到已配置节点的信标帧后,将已配置节点的网络前缀设置为自己的网络前缀;如果新节点发送的信标帧在本网格内时间戳最早,那么它将自己标记为已配置节点,并将网络前缀与自己临时地址的节点ID相结合产生一个IPv6地址,节点类型为1,同时构建分配变量,将自己节点ID相对应的比特位值设置为1;Grid initialization: After a new node in a different grid receives the beacon frame of the configured node, it sets the network prefix of the configured node as its own network prefix; if the beacon frame sent by the new node is within the grid time stamp the earliest, then it will mark itself as a configured node, and combine the network prefix with the node ID of its temporary address to generate an IPv6 address, the node type is 1, and at the same time build an allocation variable, and set the bit corresponding to its own node ID value is set to 1;

重复上述网格初始化过程,直到每个网格内发送信标帧时间戳最早的新节点获取IPv6地址并转换为已配置节点;Repeat the above grid initialization process until the new node with the earliest timestamp of sending the beacon frame in each grid obtains an IPv6 address and converts it into a configured node;

在一个网格内,第一个已配置节点获取IPv6地址后,它广播一个0001类型信标帧,消息负载为分配变量中对应所在网格的节点ID区间的比特值;In a grid, after the first configured node obtains an IPv6 address, it broadcasts a 0001-type beacon frame, and the message load is the bit value of the node ID range corresponding to the grid in the assigned variable;

节点地址初始化:同一个网格内的已配置节点和新节点收到0001类型信标帧后,根据信标帧负载内容更新自己的分配变量;同一个网格内的新节点收到类型为0001类型信标帧后,从本网格对应的节点ID区间中随机选取一个未分配的节点ID,并将分配变量中相应比特位设置1,然后广播0001类型信标帧;Node address initialization: After the configured nodes and new nodes in the same grid receive the 0001 type beacon frame, they update their allocation variables according to the load content of the beacon frame; the new node in the same grid receives the type 0001 After the type beacon frame, randomly select an unassigned node ID from the node ID interval corresponding to this grid, and set the corresponding bit in the allocation variable to 1, and then broadcast the 0001 type beacon frame;

同一个网格内的新节点重复上述节点地址初始化过程,直到本网格内所有新节点都获取IPv6地址并变成已配置节点;New nodes in the same grid repeat the above node address initialization process until all new nodes in this grid obtain IPv6 addresses and become configured nodes;

一个网格内所有新节点获取IPv6地址后,第一个已配置节点Y广播一个0010类型信标帧,消息负载为节点Y所在网格的坐标以及分配变量中对应所在网格的节点ID区间的比特值;该信标帧在网络内广播,每个收到该信标帧的已配置节点和新节点用负载中的比特值更新自己的分配变量中对应该网格的节点ID区间的比特值;After all new nodes in a grid obtain IPv6 addresses, the first configured node Y broadcasts a 0010-type beacon frame, and the message load is the coordinates of the grid where node Y is located and the node ID range corresponding to the grid where node Y is located in the allocation variable. Bit value; the beacon frame is broadcast in the network, and each configured node and new node that receives the beacon frame updates the bit value corresponding to the node ID interval of the grid in its allocation variable with the bit value in the load ;

网络内所有新节点获取IPv6地址后,它们的分配变量都相同,然后利用网络前缀和分配变量获取网络ID。After all new nodes in the network obtain IPv6 addresses, their distribution variables are the same, and then use the network prefix and distribution variables to obtain the network ID.

本发明利用现有的信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,此外,节点的地址配置并行进行,从而有效降低了地址配置代价和延迟。The present invention utilizes the existing beacon frame to realize address configuration, the node performs address configuration according to the allocation variable and can obtain a unique address without information interaction with other nodes, in addition, the node address configuration is performed in parallel, thereby effectively reducing the address configuration costs and delays.

已配置节点获取网络ID,开始定期广播0101类型信标帧;The configured node obtains the network ID and starts broadcasting 0101 type beacon frames periodically;

新节点加入网络后,首先获取自己的地理坐标并获取所在网格的坐标,同时侦听来自相同网格内的邻居已配置节点的0101类型信标帧;After the new node joins the network, it first obtains its own geographic coordinates and obtains the coordinates of the grid where it is located, and at the same time listens to the 0101 type beacon frame from the neighbor configured nodes in the same grid;

如图3所示,新节点Z收到相同网格中的邻居已配置节点M的0101类型信标帧后,根据下述过程获取IPv6地址:As shown in Figure 3, after the new node Z receives the 0101 type beacon frame of the neighbor configured node M in the same grid, it obtains the IPv6 address according to the following process:

步骤101:开始;Step 101: start;

步骤102:新节点Z用信标帧中的分配变量值更新自己的分配变量,然后从本网格对应的节点ID区间中随机选取一个未分配的节点ID,将分配变量中相应比特位设置为1,将自己标记为已配置节点,然后广播0010类型信标帧,同时向已配置节点M发送类型为0011类型信标帧;Step 102: The new node Z updates its own allocation variable with the allocation variable value in the beacon frame, then randomly selects an unallocated node ID from the node ID interval corresponding to this grid, and sets the corresponding bit in the allocation variable to 1. Mark itself as a configured node, then broadcast a beacon frame of type 0010, and send a beacon frame of type 0011 to the configured node M at the same time;

步骤103:无线网络内的节点收到已配置节点Z广播的0010类型信标帧后,用消息负载更新自己的分配变量;Step 103: After the nodes in the wireless network receive the 0010 type beacon frame broadcast by the configured node Z, they update their allocation variables with the message payload;

步骤104:已配置节点M收到0011类型信标帧后,向已配置节点Z返回一个类型为0100的信标帧,消息负载为自己的分配变量;Step 104: After receiving the beacon frame of type 0011, the configured node M returns a beacon frame of type 0100 to the configured node Z, and the message load is its assigned variable;

步骤105:已配置节点Z收到已配置节点M的信标帧后,用信标帧负载中的分配变量来更新自己除本网格以外的其他网格对应的节点ID区间的比特值;Step 105: After the configured node Z receives the beacon frame of the configured node M, it uses the allocation variable in the load of the beacon frame to update the bit value of the node ID range corresponding to other grids except this grid;

步骤106:结束。Step 106: end.

新节点加入网络后通过上述过程可以获取具有唯一性的地址,由于新节点利用现有信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,因此有效降低了地址配置代价和延迟。After the new node joins the network, the unique address can be obtained through the above process. Since the new node uses the existing beacon frame to realize the address configuration, the node configures the address according to the allocation variable and can obtain a unique address without information interaction with other nodes. Unique addresses, thus effectively reducing address configuration costs and delays.

图4为本发明所述地址回收流程示意图。如果已配置节点Z检测到所在网格中节点ID区间对应的分配变量值都为1,那么它发起下述地址回收操作:FIG. 4 is a schematic diagram of an address reclamation process according to the present invention. If the configured node Z detects that the allocation variable values corresponding to the node ID range in the grid where it is located are all 1, then it initiates the following address recovery operation:

步骤201:开始;Step 201: start;

步骤202:已配置节点Z向在本网格内获取节点ID的每个已配置节点发送1001类型信标帧;Step 202: The configured node Z sends a 1001 type beacon frame to each configured node that obtains the node ID in the current grid;

步骤203:已配置节点收到1001类型信标帧后,向已配置节点Z返回1010类型信标帧;Step 203: After the configured node receives the 1001 type beacon frame, it returns the 1010 type beacon frame to the configured node Z;

步骤204:判断已配置节点Z是否收到在本网格内获取节点ID的已配置节点返回的1010类型信标帧,如果是,进行步骤206,否则进行步骤205;Step 204: Determine whether the configured node Z has received the 1010 type beacon frame returned by the configured node that obtained the node ID in the grid, if yes, proceed to step 206, otherwise proceed to step 205;

步骤205:已配置节点Z将为返回1010类型信标帧的节点的节点ID对应的分配变量中的比特位设置为0;Step 205: The configured node Z will set the bit in the allocation variable corresponding to the node ID of the node returning the 1010 type beacon frame to 0;

步骤206:判断已配置节点Z的分配变量是否发生变化,如果是,进行步骤207,否则进行步骤208;Step 206: Determine whether the allocation variable of the configured node Z has changed, if yes, go to step 207, otherwise go to step 208;

步骤207:已配置节点Z广播0010类型信标帧,无线网络内的已配置节点和新节点收到已配置节点Z广播的0010类型信标帧后,更新自己分配变量中的相应比特位;Step 207: The configured node Z broadcasts a 0010-type beacon frame, and after receiving the 0010-type beacon frame broadcast by the configured node Z, the configured nodes and new nodes in the wireless network update the corresponding bits in their assigned variables;

步骤208:结束。Step 208: end.

节点通过上述过程回收地址资源从而确保有足够的地址资源可供分配,增加了地址配置成功率。由于节点利用现有信标帧实现了地址回收,因此有效降低了地址回收代价和延迟。The node reclaims address resources through the above process to ensure that there are enough address resources available for allocation, increasing the success rate of address configuration. Since the node utilizes the existing beacon frame to implement address recovery, the cost and delay of address recovery are effectively reduced.

图5为本发明所述条件1的网络合并流程示意图。当以下两种条件之一发生时,判定为两个网络合并:FIG. 5 is a schematic diagram of a network merging process under condition 1 of the present invention. When one of the following two conditions occurs, it is determined that the two networks are merged:

条件1,已配置节点X与已配置节点Y的网络ID不一致,包括两种子条件,两种子条件只要满足其一即视为满足条件1:Condition 1, the network IDs of configured node X and configured node Y are inconsistent, including two sub-conditions, as long as one of the two sub-conditions is met, it is deemed to meet condition 1:

子条件1,已配置节点X的网络前缀与已配置节点Y的网络前缀不同;Sub-condition 1, the network prefix of configured node X is different from the network prefix of configured node Y;

子条件2,已配置节点X的网络前缀与已配置节点Y的网络前缀相同,但是已配置节点X的分配变量和已配置节点Y的分配变量不同;Sub-condition 2, the network prefix of the configured node X is the same as the network prefix of the configured node Y, but the allocation variable of the configured node X is different from the allocation variable of the configured node Y;

条件2,已配置节点X与已配置节点Y的网络ID相同且已配置节点X与已配置节点Y的地址相同;Condition 2, configured node X and configured node Y have the same network ID and configured node X and configured node Y have the same address;

如图5所示,如果已配置节点X位于无线网络1中,已配置节点Y位于无线网络2中,已配置节点X收到已配置节点Y的0101类型信标帧后,且已配置节点X检测到已配置节点Y的网络ID与自己的网络ID不同,且无线网络1已配置地址数小于无线网络2中已配置地址数,那么已配置节点X发起下述合并操作:As shown in Figure 5, if configured node X is located in wireless network 1 and configured node Y is located in wireless network 2, after configured node X receives the 0101 type beacon frame from configured node Y, and configured node X It is detected that the network ID of configured node Y is different from its own network ID, and the number of configured addresses in wireless network 1 is less than the number of configured addresses in wireless network 2, then configured node X initiates the following merge operation:

步骤301:开始;Step 301: start;

步骤302:已配置节点X向已配置节点Y发送0011类型信标帧,已配置节点Y收到该0011类型信标帧后,向已配置节点X返回一个0100类型信标帧,0100类型信标帧负载为已配置节点Y的分配变量;Step 302: The configured node X sends a 0011 type beacon frame to the configured node Y, and after the configured node Y receives the 0011 type beacon frame, it returns a 0100 type beacon frame to the configured node X, and the 0100 type beacon frame The frame load is the allocation variable of the configured node Y;

步骤303:已配置节点X比较自己的分配变量以及已配置节点Y的分配变量的每个比特位;Step 303: The configured node X compares its own allocation variable with each bit of the allocation variable of the configured node Y;

步骤304:判断已配置节点X是否与无线网络2中的已配置节点具有重复的节点ID,如果是,进行步骤305,否则进行步骤306;Step 304: judging whether the configured node X has the same node ID as the configured node in the wireless network 2, if yes, proceed to step 305, otherwise proceed to step 306;

步骤305:已配置节点X为自己分配一个在无线网络1和无线网络2中都未分配的节点ID,并将自己的分配变量中相应的比特位设置为1;Step 305: The configured node X assigns itself a node ID that is not assigned in both wireless network 1 and wireless network 2, and sets the corresponding bit in its own allocation variable to 1;

步骤306:已配置节点X为无线网络1中每个具有重复节点ID的已配置节点分配一个在无线网络1和无线网络2中都未分配的节点ID,并将自己的分配变量中相应的比特位设置为1,最后向每个具有重复节点ID的已配置节点发送一个0110类型信标帧,消息负载为分配的节点ID;Step 306: Configured node X allocates a node ID that is not allocated in both wireless network 1 and wireless network 2 to each configured node in wireless network 1 with a repeated node ID, and assigns the corresponding bit in its own allocation variable bit is set to 1, and finally a 0110 type beacon frame is sent to each configured node with a duplicate node ID, with the message payload being the assigned node ID;

步骤307:具有重复节点ID的已配置节点收到0110类型信标帧后,更新自己的地址,即将原来地址的节点ID设置为消息负载中的节点ID;Step 307: After receiving the 0110-type beacon frame, the configured node with the repeated node ID updates its own address, that is, the node ID of the original address is set as the node ID in the message payload;

步骤308:已配置节点X广播0111类型信标帧,消息负载为无线网络2的网络前缀以及自己的分配变量和已配置节点Y的信标变量的或操作值;Step 308: The configured node X broadcasts a 0111 type beacon frame, and the message load is the network prefix of the wireless network 2 and its own allocation variable and the OR operation value of the configured node Y's beacon variable;

步骤309:无线网络1中的节点收到0111类型信标帧后,将自己IPv6地址中的网络前缀更新为信标帧中的网络前缀,同时将自己的分配变量值设置为信标帧中的分配变量值,无线网络2中的节点收到0111类型信标帧后,将自己的分配变量设置为信标帧中的分配变量值,地址保持不变;Step 309: After receiving the 0111-type beacon frame, the nodes in wireless network 1 update the network prefix in their IPv6 address to the network prefix in the beacon frame, and set their assigned variable values to the network prefix in the beacon frame at the same time. Assign the variable value, after the node in the wireless network 2 receives the 0111 type beacon frame, set its own assigned variable as the assigned variable value in the beacon frame, and the address remains unchanged;

步骤310:结束;Step 310: end;

在上述网络合并过程中,本发明利用网络ID可有效判断网络合并的发生,此外网络合并采用信标帧来实现,从而降低了网络合并代价和延迟;在网络合并过程中,根据分配变量只需对具有重复地址的节点进行重新进行地址配置,从而进一步降低了网络合并代价和延迟In the above-mentioned network merging process, the present invention utilizes the network ID to effectively determine the occurrence of network merging. In addition, the network merging is implemented using beacon frames, thereby reducing the network merging cost and delay; in the network merging process, only Re-address reconfiguration of nodes with duplicate addresses, further reducing network consolidation costs and delays

图6为本发明所述条件2的网络合并流程示意图。假设已配置节点X位于无线网络1中,已配置节点Y位于无线网络2中,已配置节点X收到已配置节点Y的0101类型信标帧后,检测到已配置节点Y的网络ID与自己的网络ID不同但是网络前缀相同,如果无线网络1中已配置地址数小于无线网络2中的已配置地址数,那么已配置节点X发起下述合并操作:Fig. 6 is a schematic diagram of the network merging process under condition 2 of the present invention. Assume that configured node X is located in wireless network 1, and configured node Y is located in wireless network 2. After receiving configured node Y's 0101 beacon frame, configured node X detects that the configured node Y's network ID is the same as its own different network IDs but the same network prefix, if the number of configured addresses in wireless network 1 is less than the number of configured addresses in wireless network 2, the configured node X initiates the following merge operation:

步骤401:开始;Step 401: start;

步骤402:已配置节点X向已配置节点Y发送0011类型信标帧;Step 402: The configured node X sends a 0011 type beacon frame to the configured node Y;

步骤403:已配置节点Y收到该信标帧后,向已配置节点X返回一个0100类型信标帧,0100类型信标帧的负载为已配置节点Y的分配变量;Step 403: After the configured node Y receives the beacon frame, it returns a 0100 type beacon frame to the configured node X, and the load of the 0100 type beacon frame is the allocated variable of the configured node Y;

步骤404:已配置节点X广播类型0111类型信标帧,负载为自己的分配变量和已配置节点Y的分配变量的或操作值;Step 404: The configured node X broadcasts a beacon frame of type 0111, and the payload is the or operation value of its own allocation variable and the allocation variable of the configured node Y;

步骤405:无线网络1和无线网络2中的节点收到0111类型信标帧后,将自己的分配变量设置为信标帧中的分配变量值,地址保持不变;Step 405: After receiving the 0111-type beacon frame, the nodes in wireless network 1 and wireless network 2 set their own allocation variable as the value of the allocation variable in the beacon frame, and the address remains unchanged;

步骤406:已配置节点X比较自己的分配变量以及已配置节点Y的分配变量的每个比特位,向两个网络中每个具有重复节点ID的已配置节点发送1000类型信标帧;Step 406: The configured node X compares its own allocation variable with each bit of the allocation variable of the configured node Y, and sends a 1000-type beacon frame to each configured node with a duplicate node ID in the two networks;

步骤407:具有重复节点ID的已配置节点收到1000类型信标帧后,将自己标记为新节点,执行步骤101到步骤106重新获取地址;Step 407: After receiving the 1000-type beacon frame, the configured node with the duplicate node ID marks itself as a new node, and performs steps 101 to 106 to obtain the address again;

步骤408:结束;Step 408: end;

如果已配置节点X检测到它与已配置节点Y的网络ID和地址都相同,那么已配置节点X广播1000类型信标帧,无线网络1和无线网络2中的节点收到该1000类型信标帧后,将自己标记为新节点,然后重新执行网络初始化;If configured node X detects that it has the same network ID and address as configured node Y, then configured node X broadcasts a 1000 type beacon frame, and nodes in wireless network 1 and wireless network 2 receive the 1000 type beacon After the frame, mark itself as a new node, and then re-execute the network initialization;

如果一部分节点从网络分裂出来,由于这些分裂出来的节点的IPv6地址具有唯一性,因此无需做任何操作即可保证地址的唯一性。If some nodes are split from the network, since the IPv6 addresses of these split nodes are unique, the uniqueness of the addresses can be guaranteed without any operation.

在上述网络合并过程中,本发明利用网络ID可有效判断网络合并的发生,此外网络合并采用信标帧来实现,从而降低了网络合并代价和延迟;在网络合并过程中,根据分配变量只需对具有重复地址的节点进行重新进行地址配置,从而进一步降低了网络合并代价和延迟。In the above-mentioned network merging process, the present invention utilizes the network ID to effectively determine the occurrence of network merging. In addition, the network merging is implemented using beacon frames, thereby reducing the network merging cost and delay; in the network merging process, only Re-configure addresses for nodes with duplicate addresses, thereby further reducing network consolidation costs and delays.

综上所述,本发明提供了一种无线网络的通信实现方法,此项技术可以应用于车载监控、医疗健康、军事国防等诸多领域,例如,在车载监控领域,可将无线网络的通信实现方法技术应用于道路拥塞监控,每台车辆里可安装多个节点,这些节点实现配置地址后,可以进行信息通信,传输道路交通情况,以有效避免道路拥塞,保持交通畅通,因此,本技术具有很高的推广价值。In summary, the present invention provides a method for implementing wireless network communication. This technology can be applied to many fields such as vehicle monitoring, medical health, military defense, etc. For example, in the field of vehicle monitoring, wireless network communication can be implemented The method technology is applied to road congestion monitoring. Multiple nodes can be installed in each vehicle. After these nodes are configured with addresses, they can carry out information communication and transmit road traffic conditions, so as to effectively avoid road congestion and keep traffic smooth. Therefore, this technology has the advantages of High promotional value.

本发明提供了一种无线网络的通信实现方法的思路,具体实现该技术方案的方法和途径很多,以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。本实施例中未明确的各组成部份均可用现有技术加以实现。The present invention provides an idea of a wireless network communication implementation method. There are many methods and ways to specifically realize the technical solution. The above description is only a preferred implementation mode of the present invention. It should be pointed out that for those of ordinary skill in the art That is to say, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications should also be regarded as the protection scope of the present invention. All components that are not specified in this embodiment can be realized by existing technologies.

实施例1Example 1

基于表1的仿真参数,本实施例模拟了本发明中方法,性能分析如下:当节点数量增加时,平均地址配置代价和延迟均随着节点数量的增加而增加,网络合并代价和延迟也随着节点的数量增加而增加。本发明中,新节点利用现有信标帧实现了地址配置,节点根据分配变量进行地址配置且无需与其他节点进行信息交互即可获取具有唯一性的地址,因此有效降低了地址配置代价和延迟。此外,本发明利用网络ID可有效判断网络合并的发生,此外网络合并采用信标帧来实现,从而降低了网络合并代价和延迟;在网络合并过程中,根据分配变量只需对具有重复地址的节点进行重新进行地址配置,从而进一步降低了网络合并代价和延迟。在地址配置过程中,平均地址配置代价为20,平均地址配置延迟为40ms,在网络合并过程中,平均网络合并代价为300,平均网络合并延迟为600ms。Based on the simulation parameters in Table 1, this embodiment simulates the method in the present invention, and the performance analysis is as follows: when the number of nodes increases, the average address configuration cost and delay all increase with the increase of the number of nodes, and the network merge cost and delay also increase with the increase of the number of nodes. increases with the number of nodes. In the present invention, the new node realizes the address configuration by using the existing beacon frame, and the node configures the address according to the allocation variable and can obtain a unique address without information interaction with other nodes, thus effectively reducing the address configuration cost and delay . In addition, the present invention can effectively judge the occurrence of network merging by using the network ID. In addition, the network merging is implemented by using beacon frames, thereby reducing the cost and delay of network merging; The node reconfigures the address, which further reduces the cost and delay of network merging. In the address configuration process, the average address configuration cost is 20, and the average address configuration delay is 40ms. In the network merging process, the average network merging cost is 300, and the average network merging delay is 600ms.

表1仿真参数Table 1 Simulation parameters

Claims (1)

1. a kind of Realization Method of Communication of wireless network, it is characterised in that the zone of action of the wireless network is by 2n1×2n2It is individual The square net of two dimension is constituted, and n1 and n2 is positive integer, and the length of side isTransmission radiuses of the r for mobile node, each grid Coordinate be (x, y), x<2n1,y<2n2, x and y is nonnegative integer;Mobile node obtains the geographical coordinate of oneself by GPS technology (Gx, Gy), then obtains the coordinate (x, y) of its place grid according to formula (1) and (2);
The division of wireless network and merging process are all carried out in zone of action;
Wireless network includes two class nodes:New node and configured node, new node are the node for not obtaining IPv6 addresses; Configuration node is the node for having obtained IPv6 addresses, and configured node preserves a distribution variable, is currently located to record The address configuration situation of wireless network;
The IPv6 addresses of wireless network interior joint are made up of three parts, and Part I is network prefix, and network prefix is by random letter Number is randomly generated, and in a wireless network, the network prefix of the IPv6 addresses of all nodes is all identical;Part II is node class Type, length are 1 bit, when the value is 1, are shown to be configured node, when the value is 0, are shown to be new node;Part III is section Point ID, length are i bits, and it has uniqueness, one configured node of unique mark in a wireless network;
Each configured node preserves a distribution variable, and the length of the variable is 2i- 2, i.e., do not include 0 and 2i- 1, i are more than 1 And the positive integer less than 127, unique one node ID of correspondence of each bit, from right to left incremented by successively 1, each bit Value represent respective nodes ID whether be allocated, 1 represent distribute, 0 represent it is unallocated;
Distribution variable adopts lower sheet form:
The address allocation space of node ID is 2i- 2, respectively it is distributed in 2n1×2n2In individual two-dimension square shape grid, mesh coordinate is As shown in formula (3), it is [P (x, y), E (x, y)] that node ID is interval to node ID space length S (x, y) of (x, y), P (x, y) and Shown in the calculating of E (x, y) such as formula (4) and (5);
Realizing address configuration and communication, front four bits of beacon frame load represent letter for each node broadcasts or unicast beacon frame The type of mark frame;
0000 type beacon frame:Load to broadcast the coordinate of the node place grid of the beacon frame;
0001 type beacon frame:Load interval to broadcast the node ID of correspondence place grid in the node distribution variable of the beacon frame Bit value;
0010 type beacon frame:Load for broadcast the beacon frame node place grid coordinate and distribution variable in correspondence institute In the bit value that the node ID of grid is interval;
0011 type beacon frame:Load as sky;
0100 type beacon frame:Load to broadcast the distribution variate-value of the node of the beacon frame;
0101 type beacon frame:The distribution for load as network ID, having distributed number of addresses and broadcasted the node of the beacon frame becomes The interval bit value of the node ID of correspondence place grid in amount;
0110 type beacon frame:Load as newly assigned node ID;
0111 type beacon frame:Message Payload is distribution variable and network prefix, and wherein network prefix is option;
1000 type beacon frames:Load as sky;
1001 type beacon frames:Message Payload is sky, for confirming whether destination node fails or leave;
1010 type beacon frames:Message Payload is sky, and the message is the response frame of 1001 type beacon frames;
If the coordinate of node Z1 places grid is (x1, y1), the coordinate of node Z2 places network is (x2, y2), then grid The comparison algorithm of coordinate figure is as follows:
If 1) x1<X2, then coordinate figure of the coordinate figure of Z1 places grid less than Z2 places grid;If x1>X2, then Z1 Coordinate figure of the coordinate figure of place grid more than Z2 places grid;
If 2) x1=x2 and y1<Y2, then coordinate figure of the coordinate figure of Z1 places grid less than Z2 places grid;If x1= X2 and y1>Y2, then coordinate figure of the coordinate figure of Z1 places grid more than Z2 places grid;
If 3) x1=x2 and y1=y2, then Z1 and Z2 is in same grid;
In original state, all nodes are new node;New node realizes ground by grid initialization and node address initialization Location configures;
New node obtains the geographical coordinate of oneself first and the coordinate (x, y) of place grid is obtained according to formula (1) and (2), so A network prefix is produced using random function afterwards, while random from place grid node ID intervals [P (x, y), E (x, y)] A node ID is chosen, network prefix and node ID are formed into a temporary address, wherein node type is 0;Obtain in new node Before taking IPv6 addresses, by temporary address unique mark;
New node obtain temporary address after, start broadcast 0000 type beacon frame, Message Source Address be its temporary address, message bear Carry the coordinate figure for place grid;
New node after the stipulated time is waited judges whether to meet one of following conditions:
Condition 1, new node do not receive any one beacon frame;
Condition 2, the source node of the beacon frame that new node is received are new node, with the source node place grid of these beacon frames Coordinate figure is compared, and the coordinate figure of its own place grid is minimum, and the timestamp of the beacon frame sent in oneself grid is earliest;
If a new node X meets one of above-mentioned condition, it then will be labeled as configured node itself, by the IPv6 ground of oneself The network prefix and node ID of location is set to the networking prefix and node ID of temporary address, and node type is 1, while building distribution Oneself node ID corresponding bit place value is set to 1 by variable;
Grid is initialized:Receive after the beacon frame of configured node positioned at the new node of different grids, by the net of configured node Network prefix is set to the network prefix of oneself;If the beacon frame that new node sends timestamp in this grid is earliest, then it Configured node oneself will be labeled as, and network prefix be combined with the node ID of oneself temporary address with producing an IPv6 Location, node type are 1, while building distribution variable, oneself node ID corresponding bit place value are set to 1;
The above-mentioned grid initialization procedure of repetition, sends the earliest new node of beacon frame timestamp in each grid and obtains IPv6 Address is simultaneously converted to configured node;
In a grid, after first configured node obtains IPv6 addresses, it broadcasts a 0001 type beacon frame, message Load to distribute the node ID of correspondence place grid in variable interval bit value;
Node address is initialized:After configured node and new node in same grid receives 0001 type beacon frame, according to Beacon frame load contents update the distribution variable of oneself;New node in same grid receives type for 0001 type beacon frame Afterwards, a unappropriated node ID is randomly selected from this grid corresponding node ID interval, and will be accordingly compared in distribution variable Special position arranges 1, then node ID combines to form the address of oneself with the network prefix of the source address of beacon frame, its interior joint Type is 1, and is converted to configured node, then broadcasts 0001 type beacon frame;
New node in same grid repeats above-mentioned node address initialization procedure, and in this grid, all new nodes are all obtained Take IPv6 addresses and become configured node;
After in one grid, all new nodes obtain IPv6 addresses, first configured node Y broadcasts a 0010 type beacon Frame, Message Payload are the interval bit of the node ID of correspondence place grid in the coordinate and distribution variable of node Y places grid Value;The beacon frame is broadcasted in network, and each receives the bit value in the configured node of the beacon frame and new node load Update in the distribution variable of oneself to should grid the interval bit value of node ID;
After in network, all new nodes obtain IPv6 addresses, their distribution variable is all identical, then using network prefix and point Network ID is obtained with variable;
Configured node obtains network ID, starts 0101 type beacon frame of periodic broadcasting;
New node add network after, obtain the geographical coordinate of oneself first and obtain the coordinate of place grid, at the same intercept from 0101 type beacon frame of the configured node of neighbours in same mesh;
After new node Z receives 0101 type beacon frame of the configured node M of neighbours in same mesh, according to following Procedure Acquisitions IPv6 addresses:
Step 101:Start;
Step 102:Distribution variate-value in new node Z beacon frames updates the distribution variable of oneself, then from this grid correspondence Node ID interval in randomly select a unappropriated node ID, will distribution variable in corresponding bits position be set to 1, will choose Node ID combine to form the IPv6 addresses of oneself with the network prefix of the configured node M of neighbours, node type is 1, will be from Oneself is labeled as configured node, then broadcasts 0010 type beacon frame, while being 0011 type to configured node M transmission types Beacon frame;
Step 103:After node in wireless network receives 0010 type beacon frame of configured node Z broadcast, Message Payload is used Update the distribution variable of oneself;
Step 104:After configured node M receives 0011 type beacon frame, it is 0100 to return a type to configured node Z Beacon frame, Message Payload are the distribution variable of oneself;
Step 105:After configured node Z receives the beacon frame of configured node M, with the distribution variable in beacon frame load come more The interval bit value of the corresponding node ID of new oneself other grid in addition to this grid;
Step 106:Terminate;
If configured node Z detects place grid interior joint ID, interval corresponding distribution variate-value is all 1, then it initiates Following address reclaimer operations:
Step 201:Start;
Step 202:Configured node Z-direction obtains each configured node of node ID in this grid and sends 1001 type beacons Frame;
Step 203:After configured node receives 1001 type beacon frames, 1010 type beacon frames are returned to configured node Z;
Step 204:Judge whether configured node Z receives the 1010 of the configured node return that node ID is obtained in this grid Type beacon frame, if it is, carrying out step 206, otherwise carries out step 205;
Step 205:Configured node Z is by the node ID of the node for 1010 type beacon frames of return corresponding distribution variable Bit is set to 0;
Step 206:Judge whether the distribution variable of configured node Z changes, if it is, carrying out step 207, otherwise carry out Step 208;
Step 207:Configured node Z broadcasts 0010 type beacon frame, and the configured node and new node in wireless network is received After 0010 type beacon frame of configured node Z broadcast, the corresponding bits position in oneself distribution variable is updated;
Step 208:Terminate;
When one of following two conditions occur, it is judged to that two networks merge:
Condition 1, configured nodes X are inconsistent with the network ID of configured node Y, and including two seed conditions, two seed conditions are only One to be met is and meets condition 1:
Sub- condition 1, the network prefix of configured nodes X are different from the network prefix of configured node Y;
Sub- condition 2, the network prefix of configured nodes X are identical with the network prefix of configured node Y, but configured nodes X Distribution variable it is different with the distribution variable of configured node Y;
Condition 2, configured nodes X is identical with the network ID of configured node Y and the ground of configured nodes X and configured node Y Location is identical;
If configured nodes X is located in wireless network 1, configured node Y is located in wireless network 2, and configured nodes X is received After the 0101 type beacon frame of configured node Y, and configured nodes X detect the network ID of configured node Y with oneself Network ID is different, and 1 configured number of addresses of wireless network is less than configured number of addresses in wireless network 2, then configured nodes X Initiate following union operations:
Step 301:Start;
Step 302:Configured nodes X to configured node Y send 0011 type beacon frame, configured node Y receive this 0011 After type beacon frame, a 0100 type beacon frame is returned to configured nodes X, the load of 0100 type beacon frame is configured section The distribution variable of point Y;
Step 303:Configured nodes X compares each bit of the distribution variable of the distribution variable and configured node Y of oneself Position;
Step 304:Judge that whether configured nodes X has the node ID that repeats with the configured node in wireless network 2, if It is to carry out step 305, otherwise carries out step 306;
Step 305:Configured nodes X is oneself one all unappropriated node in wireless network 1 and wireless network 2 of distribution ID, and corresponding bit in the distribution variable of oneself is set to into 1;
Step 306:Configured nodes X is that each configured node distribution one with duplicate node ID exists in wireless network 1 All unappropriated node ID in wireless network 1 and wireless network 2, and corresponding bit in the distribution variable of oneself is set to 1, most after there is the configured node of duplicate node ID to send a 0110 type beacon frame to each, Message Payload is distribution Node ID;
Step 307:After configured node with duplicate node ID receives 0110 type beacon frame, the address of oneself is updated, i.e., The node ID node ID of original address being set in Message Payload;
Step 308:Configured nodes X broadcasts 0111 type beacon frame, Message Payload for wireless network 2 network prefix and from The semaphore variable or operating value of oneself distribution variable and configured node Y;
Step 309:After node in wireless network 1 receives 0111 type beacon frame, by the network prefix in oneself IPv6 address The network prefix being updated in beacon frame, while the distribution variate-value of oneself is set to the distribution variate-value in beacon frame, nothing After node in gauze network 2 receives 0111 type beacon frame, the distribution variable of oneself is set to into the distribution variable in beacon frame Value, address keep constant;
Step 310:Terminate;
Assume that configured nodes X is located in wireless network 1, configured node Y is located in wireless network 2, and configured nodes X is received After the 0101 type beacon frame of configured node Y, the network ID for detecting configured node Y is different from the network ID of oneself still Network prefix is identical, if configured number of addresses is less than the configured number of addresses in wireless network 2 in wireless network 1, then Configuration node X initiates following union operations:
Step 401:Start;
Step 402:Configured nodes X sends 0011 type beacon frame to configured node Y;
Step 403:After configured node Y receives the beacon frame, a 0100 type beacon frame is returned to configured nodes X, Distribution variable of the load of 0100 type beacon frame for configured node Y;
Step 404:0111 type beacon frame of configured nodes X broadcast type, loads the distribution variable and configured section for oneself The distribution variable or operating value of point Y;
Step 405:After node in wireless network 1 and wireless network 2 receives 0111 type beacon frame, by the distribution variable of oneself The distribution variate-value being set in beacon frame, address keep constant;
Step 406:Configured nodes X compares each bit of the distribution variable of the distribution variable and configured node Y of oneself Position, in two networks, each configured node with duplicate node ID sends 1000 type beacon frames;
Step 407:After configured node with duplicate node ID receives 1000 type beacon frames, new section oneself will be labeled as Point, execution step 101 to step 106 reacquire address;
Step 408:Terminate;
If it is all identical with the network ID of configured node Y and address that configured nodes X detects it, then configured nodes X 1000 type beacon frames are broadcasted, after the node in wireless network 1 and wireless network 2 receives the 1000 type beacon frame, by oneself New node is labeled as, netinit is then re-executed.
CN201410202748.XA 2014-05-14 2014-05-14 Communication implementation method for wireless network Active CN103945415B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410202748.XA CN103945415B (en) 2014-05-14 2014-05-14 Communication implementation method for wireless network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410202748.XA CN103945415B (en) 2014-05-14 2014-05-14 Communication implementation method for wireless network

Publications (2)

Publication Number Publication Date
CN103945415A CN103945415A (en) 2014-07-23
CN103945415B true CN103945415B (en) 2017-03-22

Family

ID=51192846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410202748.XA Active CN103945415B (en) 2014-05-14 2014-05-14 Communication implementation method for wireless network

Country Status (1)

Country Link
CN (1) CN103945415B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104243504B (en) * 2014-10-20 2017-04-26 常熟理工学院 Safety communication implementation of next generation wireless network
CN107613454A (en) * 2017-09-21 2018-01-19 南京中高知识产权股份有限公司 Parking stall Sharing Management platform
CN109688244B (en) * 2019-02-01 2021-08-20 常熟理工学院 An efficient implementation method of wireless sensor network address configuration
CN113315708B (en) * 2021-07-29 2021-10-08 数字广东网络建设有限公司 System, method, computer equipment and storage medium for realizing grid gateway

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101873357A (en) * 2010-05-24 2010-10-27 上海宏美通信设备有限公司 Method for automatically discovering wireless access points

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7961740B2 (en) * 2007-08-01 2011-06-14 Silver Spring Networks, Inc. Method and system of routing in a utility smart-grid network

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101873357A (en) * 2010-05-24 2010-10-27 上海宏美通信设备有限公司 Method for automatically discovering wireless access points

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
An address configuration protocol for 6LoWPAN wireless sensor networks based on PDAD;Xiaonan Wang等;《ELSEVIER》;20140418;全文 *
一种多频分级Ad Hoc 网络的组网方案;张杨等;《计算机工程与应用》;20081231;全文 *
无线传感器网络IPv6地址自动配置方案;王晓喃等;《电子科技大学学报》;20110531;第40卷(第3期);全文 *

Also Published As

Publication number Publication date
CN103945415A (en) 2014-07-23

Similar Documents

Publication Publication Date Title
CN102364970A (en) A Method for Realizing Automatic Address Configuration of Mobile Ad Hoc Networks
CN102291448B (en) Automatic IP (Internet protocol) address allocation method based on geographical position in mobile ad hoc network
CN105871641B (en) A kind of data capture method based on cloud
CN102572015B (en) Implementation method for dynamic IPv6 address configuration of mobile ad hoc network
CN102572016B (en) Method for realizing cluster-based distributed mobile self-organizing network IPv6 (Internet Protocol version 6) address configuration
Xiaonan et al. An IPv6 address configuration scheme for wireless sensor networks based on location information
CN101600156A (en) A method for automatically assigning mobile ad hoc network addresses
CN102395126B (en) Mobile Ad hoc network address configuration realization method based on tree structure
CN103945415B (en) Communication implementation method for wireless network
CN102694884B (en) IPv6 address configuration and management method of wireless sensor network
CN106993321B (en) A Cluster-Based Network Data Communication Method
CN105187529A (en) Internet of vehicles implementation method based on positioning information
CN105119828B (en) A kind of quickly wireless network route implementation method
CN103281674B (en) A kind of wireless transducer network address configuration method based on locating information
CN109005567A (en) A kind of mobile network&#39;s implementation method based on cluster
CN105873027A (en) Planning method for static Zigbee network
CN103347101B (en) Based on bunch 6LoWPAN wireless transducer network address configuration method
Wang et al. A tree-based address configuration for a MANET
CN102404719A (en) Automatic address configuration method for heterogeneous wireless sensor network
Wang et al. An address configuration protocol for 6LoWPAN wireless sensor networks based on PDAD
CN102938921B (en) A kind of method of sensor networking and route, network node and system
CN103347100B (en) A kind of 6LoWPAN wireless transducer network address configuration method
Chakraborty et al. An IPv6 based hierarchical address configuration scheme for smart grid
CN104270479B (en) communication implementation method of next generation wireless network
CN103986799A (en) A wearable wireless sensor network communication method

Legal Events

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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220324

Address after: 215500 5th floor, building 4, 68 Lianfeng Road, Changfu street, Changshu City, Suzhou City, Jiangsu Province

Patentee after: Changshu intellectual property operation center Co.,Ltd.

Address before: 215500 School of computer science and engineering, Changshu Institute of Technology (southeast campus), Changshu City, Suzhou City, Jiangsu Province

Patentee before: CHANGSHU INSTITUTE OF TECHNOLOGY