Urban road-oriented broadcasting method in vehicle-mounted ad hoc network based on direction and distance
Technical Field
The invention belongs to the technical field of wireless communication, and particularly relates to a direction and distance-based broadcasting method facing an urban road in a vehicle-mounted ad hoc network.
Background
The vehicle-mounted ad hoc network is a multi-hop, centerless and ad hoc wireless communication network and mainly comprises vehicles and communication among the vehicles. The vehicle-mounted ad hoc network is a mobile network which is established by vehicles within a certain wireless coverage range, exchanges and transmits information, data and the like through respective equipped wireless communication modules and automatically connects. In the vehicle-mounted ad hoc network, a broadcasting technology is mainly researched from the aspects of restraining a broadcast storm, reducing time delay and improving broadcasting reliability.
The broadcasting scheme in the vehicle-mounted ad hoc network can be divided into two schemes, namely a broadcasting scheme facing to urban roads and a broadcasting scheme facing to expressways according to different application scenes. In urban roads, roads and traffic conditions are complex and changeable, in various existing broadcast algorithms for urban roads, different road conditions in the urban roads are not considered, some broadcast storms have poor inhibition effect, high delay or low reliability, some algorithms are too complex and difficult to realize or have high realization cost, and the method provided by the invention comprehensively considers the inhibition of the broadcast storms, the reduction of the delay and the provision of certain broadcast reliability.
Disclosure of Invention
The invention aims to provide a broadcast method facing urban roads and Based on Direction and Distance in a vehicle-mounted ad hoc network, which can effectively inhibit broadcast storms, reduce time delay, adapt to dynamically-changed network topology and provide certain reliability, in particular to a broadcast method facing the urban roads and Based on Direction and Distance (DDBB, Direction and Distance Based Broadcasting algorithm) in the vehicle-mounted ad hoc network.
In order to achieve the purpose, the invention adopts the following technical scheme: the method comprises the steps that a vehicle is used as a node in broadcasting to establish a vehicle-mounted ad hoc network, a positioning sensor of the vehicle detects and obtains a positioning position as position information of the node, wireless communication equipment installed on the vehicle is used for carrying out broadcast communication among the nodes, and each node is provided with a neighbor information table and a broadcast packet receiving record table; the neighbor information table stores neighbor node information entries, and the broadcast packet reception record table stores records of broadcast packet reception entries.
Any node is taken as a source node, the source node starts to send broadcast packets to surrounding nodes, and the nodes receiving the broadcast packets forward the broadcast packets to the surrounding nodes;
in the process of driving of each vehicle on a road, broadcast packet forwarding between nodes is carried out in different modes at different road scene positions, in the process of forwarding and broadcast communication, a source node determines to select a forwarding mode according to the position of the self road to send broadcast packets, and a relay node, namely a node which is a non-source node, determines to select the forwarding mode according to the position of the self road and the position of the road of a previous hop node to forward the broadcast packets; the previous hop node is the node from which the broadcast packet received by the node originates.
Each forwarding mode divides road areas according to road directions, preferentially selects a node which can communicate to the direction which is farthest away from the road area where the current node is located in the road area of the current node and the driving direction of the node is the direction far away from the road area where the current node is located as a next hop forwarding node, the node constructs a neighbor information table through interactive forwarding communication of broadcast packets, and then selects the node which is farthest away from the current node as the next hop forwarding node according to position information of all adjacent nodes in the neighbor information table of the node.
The broadcast grouping forwarding between nodes in different road scene positions in different modes is specifically as follows: different road scene positions are divided into a straight road scene and an intersection scene, the forwarding mode is divided into a straight road scene forwarding mode and an intersection scene forwarding mode, and the two forwarding modes are specifically respectively as follows:
(1) straight-path scenario forwarding mode
Taking any node j in the vehicle-mounted ad hoc network as a current node, and then:
in the present invention, the number of lanes and lane width are not limited, and for the sake of explanation, a straight road scene is assumed as a standard bidirectional 4-lane, and as shown in fig. 3, a straight road scene is divided into four regions E, where a straight road region is divided into four regions E, a fixed ray direction from a node j to a center of a road is taken as a center of a circle, an angle of a reference is 0 ° and an angle of an increase is counterclockwise, and a fixed ray direction from the center of the circle is taken as an angle reference1、E2、F1、F2:
E1:(270°,360°];E2:(0°,90°]
F1:(90°,180°];F2:(180°,270°];
Firstly, according to the position coordinate (x) of the q-th adjacent node in the adjacent information table of the node jjq,yjq) And the position of the center of the circle (x)o,yo) Calculating the distance d between the qth adjacent node and the circle centerjqAnd the connecting line angle value omega between the qth adjacent node and the circle centerjqThen according to the angle value omega of the connecting linejqJudging neighboring nodes belonging to four regions E1、E2、F1、F2Which area in the node j is used as the road area of the adjacent node, wherein q is 1,2,3 … … n, n represents the total number of the adjacent nodes in the neighbor information table of the node j, and all the adjacent nodes are marked according to the method;
(2) intersection scene forwarding mode
Taking any node j in the vehicle-mounted ad hoc network as a current node, and then:
the invention has no limit to the number of lanes and the lane width of the road junction scene, in order to reflect the generality of the road junction scene, any branch can be absent in the assumed road junction scene to form a T-shaped road junction, a turning road junction and the like, which are respectively shown in figures 5-7, the arrow direction represents the driving direction of a node, and the road junction is taken as an example;
four corner vertex positions m of known road along single clockwise/counterclockwise ordering1、m2、m3And m4Corner vertex position m1、m2、m3And m4All acquired by a digital map and a positioning system, and connecting lines m between the vertexes of the corners1m3Connecting line m with corner vertex2m4The intersection point of (a) is taken as the center of a circle, namely, the vertex position m of four corners1、m2、m3And m4The intersection point of two diagonal lines of the formed quadrangle is taken as the center of a circle, the direction of a fixed ray starting from the center of a circle is taken as the standard of an angle of 0 degree, the anticlockwise direction is taken as the increasing direction of the angle, and the center of a circle is respectively taken as the connecting line and the corner of the tail end of the solid line between the two-way lanes on each roadVertex m1m3、m2m4The connecting lines divide the intersection area into eight areas, and the directions of the roads with the angle of 0 degree are taken as the reference and are sequentially A1、A2、B1、B2、C1、C2、D1And D2By comparing the position coordinates (x) of the q-th neighbor node in the neighbor information table of the node jjq,yjq) At the position and eight areas A1、A2、B1、B2、C1、C2、D1And D2The relation between the eight regions is obtained to which one of the eight regions the adjacent node belongs and is used as the road region of the adjacent node, wherein the eight regions are merged and simultaneously divided into four road branch regions according to the same driving region positioned at two sides of the solid line.
In the invention, the assumed intersection scene is a universal intersection situation, so common intersection scenes such as a T-shaped intersection, a turning intersection, a roundabout intersection and the like can be also suitable for the invention.
The position of the node on the road scene is judged according to the following modes: judging whether the node is in the range of a circle with the center point of the intersection as the circle center and the radius of 150m according to the positioning position of the node, if so, enabling the node to be in the road scene position of the intersection scene, and carrying out the intersection scene forwarding mode; otherwise, the node is positioned at the road scene position of the straight road scene, and the straight road scene forwarding mode is carried out.
The node driving direction is judged according to the node road area, the divided road areas are all single driving directions, and the vehicle driving direction of the node road area is the driving direction of the node.
The broadcast packet forwarding specifically includes:
(1) the source node sends a broadcast packet:
taking any node i in the vehicle-mounted ad hoc network as a source node for generating broadcast packets, and then:
firstly, adding a record received by the broadcast packet in a broadcast packet receiving record table of a source node i, so that the source node i can uniformly process the broadcast packet when receiving the broadcast packet again, and then judging whether a neighbor node exists in a neighbor information table of the source node i:
if not, 4 same special addresses (254.255.255.255) are used as the forwarding node addresses;
if yes, further judging whether the source node i is in a straight road scene or an intersection scene:
if the node is in the straight road scene, selecting a next hop forwarding node by adopting a straight road scene forwarding mode;
if the node is in the intersection scene, selecting a next skip sending node by adopting an intersection scene forwarding mode;
(2) after receiving the broadcast packet, any node j processes and forwards the broadcast packet in the following way:
if the node j receives a broadcast packet from the previous hop node h, whether the broadcast packet is received from the node h for the first time or not and whether the broadcast packet is received for the first time are sequentially judged, and then corresponding processing is carried out:
or establishing or updating an entry corresponding to the previous hop node h for sending the broadcast packet in the neighbor information table;
or forwarding according to the probability or the address of the forwarding node in the broadcast packet header, determining different forwarding modes and selecting the next hop forwarding node according to the position of the road scene of the forwarding node before forwarding and the position of the road scene of the previous hop node h, namely the position in a straight road scene or an intersection scene, writing the address of the forwarding node into the header of the broadcast packet to be sent, and forwarding the broadcast packet;
or discarding the broadcast packet because the broadcast packet has been received;
(3) the item of each adjacent node k in the neighbor information table of any node j is provided with timeout time T1In the process that any two nodes of the node j and the adjacent node k communicate with each other, deleting the item of the adjacent node k in the neighbor information table of the node j in the following mode, wherein the node k is the adjacent node of the node j:
if the corresponding overtime time T is under the adjacent node k item in the neighbor information table of the node j1If the time is up, the time-out time T is indicated1The information of the neighbor node k in the internal neighbor information table is not receivedAnd after refreshing, the neighbor node k is not sent by the broadcast packet for a long time and is not the neighbor of the node j, and the entry of the corresponding node k in the neighbor information table of the node j is deleted.
(4) And (3) repeatedly and alternately executing the steps (1) to (3) by all nodes in the network until all nodes do not need to forward the broadcast packet any more.
The invention particularly divides the forwarding mode into a straight road and an intersection scene forwarding mode, each mode divides a road area according to the direction, and a node with the farthest distance is taken as a forwarding node in the selected road area.
Each current node sends a broadcast packet specifically: writing the address of a source node i, the serial number of the broadcast packet, the broadcast destination IP address, the address of a current node j, the position coordinate of the current node j, the address of a forwarding node and the position state of the current node j into the head of the broadcast packet, and then sending the broadcast packet. When a broadcast packet is received, an entry is created in the broadcast reception record table for the received broadcast packet, and a received record of the broadcast packet is added to the entry.
The step (2) is specifically as follows:
when any node j receives a broadcast packet from the previous hop node h, the following method is adopted for processing and forwarding:
(2-1) first, it is judged whether node j receives the broadcast packet from node h for the first time:
if yes, establishing a neighbor information entry of the node h in a neighbor information table of the node j, taking the node h as a neighbor node, and broadcasting the position information (x) of the node h in the packet headerh,yh) Storing the entry and writing the timeout T in the corresponding position of the entry1Turn to (2-2);
if not, updating the position information (x) of the node h in the neighbor information tableh,yh) And resetting the timeout period T1Turning to (2-2);
(2-2) judging whether there is a record that the broadcast packet has been received in the broadcast packet reception record table of the node j according to the source node IP address and the broadcast packet sequence number in the received broadcast packet:
if yes, discarding the broadcast packet, and turning to (2-5);
if not, adding the received record of the broadcast packet in the broadcast packet receiving record table of the node j, and then judging whether all the 4 forwarding node addresses of the header of the received broadcast packet are special addresses (254.255.255.255):
if yes, the node j forwards the broadcast packet with the probability of 0.5, and then the step is turned to (2-3);
if not, judging whether the address of the node j is in the forwarding node address list of the broadcast packet head:
if yes, the node j needs to forward the broadcast packet, and the direction is turned to (2-3);
if not, discarding the broadcast packet (all data of the broadcast packet are discarded), and turning to (2-5);
(2-3) the node j selects different forwarding modes and selects the next hop forwarding node according to the road scene positions of the node j and the previous hop node h, namely, the node j is positioned in a straight road scene or a crossing scene:
if the previous hop node h is located in a straight road scene and the node j is located in the straight road scene, adopting a straight road scene forwarding mode, removing a road area where the previous hop node h is located, selecting a next hop forwarding node in another road area in the same node driving direction according to the method of FIG. 7, and turning to (2-4);
if the previous hop node h is located in a straight road scene and the node j is located in an intersection scene, the node j needs to select a next hop forwarding node in different directions of the intersection, a crossing scene forwarding mode is adopted, the area of the road where the previous hop node h is located is removed, the next hop forwarding node is selected on the remaining three road areas according to the method shown in the figure 8, and the vehicle turns (2-4);
if the previous hop node h is located in the intersection scene, directly adopting a straight road scene forwarding mode without judging the road scene position of the node j, selecting a next hop forwarding node in the road area of the traveling direction of the node j according to the method of FIG. 7, and turning (2-4);
if the previous-hop node h is located in the intersection scene, the following two types are specifically adopted:
if the previous hop node h is positioned in the intersection scene and the node j is positioned in the intersection scene, the node j is the selected next hop forwarding node positioned in different directions of the intersection, and at the moment, the node j does not need to select the next hop forwarding node in different directions of the intersection, and a straight-path scene forwarding mode is adopted;
if the node h of the previous hop is located in the intersection scene and the node j is located in the straight road scene, the node j is forwarded on the straight road next time, and then the straight road scene forwarding mode is also adopted.
(2-4) the node j writes the source node address of the broadcast packet, the serial number of the broadcast packet, the destination IP address of the broadcast packet, the address of the current node j, the position coordinate of the current node j, the address of the next hop forwarding node and the position state of the current node j into the head of the broadcast packet to be forwarded, and sends the broadcast packet;
and (2-5) finishing.
The node forwarding the broadcast packet with a probability of 0.5 specifically includes: the node j generates a random number p uniformly distributed in the range of 0-1 by using a random function, and if p is greater than 0.5, the broadcast packet is directly discarded; otherwise node j forwards the broadcast packet.
The node calculates the connecting line angle between the adjacent node and the circle center by adopting the following method:
the connecting line angle value omega of the adjacent node k of any node j and the circle center can be determined according to the position coordinates of the two nodesk. The method for calculating the angle is as follows: firstly, the position coordinate (x) of the adjacent node k in the neighbor information table of the node j is checkedk,yk) In combination with the position coordinates (x) of the centre of the circleo,yo) Calculating the connecting line angle value omega of the adjacent node k and the circle center by the following formulak。
Wherein L is the slope of the line connecting the neighboring node k and the center of the circle.
But ω cannot be determined by L alonekTherefore, ω is also uniquely determined in combination with the following equationkThe value of (c).
Y=yk-yo
If both L and Y are positive, then ωk∈(0°,90°];
If the value of L is negative and the value of Y is positive, then ωk∈(90°,180°];
If the value of L is positive and the value of Y is negative, then ωk∈(180°,270°];
If the value of L is negative and the value of Y is negative, then ωk∈(270°,360°]。
By the method, the connecting line angle value omega of the adjacent node k and the circle center can be accurately obtainedk。
The network requirements designed by the method of the invention are as follows:
all nodes in the network adopt an omnidirectional antenna mode; the nodes in the network are all on the same plane, and the positions of all the nodes are equal; the nodes in the network adopt a distributed structure; when nodes in the network are within the communication range of each other, each node adopts a bidirectional communication link; the transmitting power and the receiving power of each node in the network are the same, and the range covered by the transmitted message is a circle with the radius of R; all the nodes are provided with digital maps, and a positioning system is installed, so that the geographic coordinates of the nodes and all positions in a road scene can be acquired in real time, and the nodes are known to be in a straight road scene or an intersection scene; all the nodes are located in an urban road scene, the urban road scene comprises a straight road scene and an intersection scene, the road can be a one-way or two-way lane, the width and the number of the lanes are not limited, and a certain road branch in the intersection scene is allowed to be absent.
The broadcast packet includes a source node IP address, a broadcast packet sequence number, a broadcast destination IP address, a current node IP address, position coordinates of a current node, an IP address of a forwarding node, a position status of a current node, and a data area.
The neighbor information table of the node comprises the IP address of the current node, the IP address of the neighbor node, the position coordinate of the neighbor node and the timeout time of the neighbor node.
According to the actual condition of an urban road, a forwarding mode is divided into a straight road scene forwarding mode and an intersection scene forwarding mode, and the nodes automatically switch the forwarding mode according to the position states of the nodes per se and the nodes of the previous hop; in both forwarding modes, the number of lanes, the lane width and the specific intersection condition are not considered, the regions are divided according to the road direction, and a node is selected in each selected direction region to serve as a next skip forwarding node; preferentially selecting a neighbor node farthest from the current node in an area with the node driving direction far away from the current node, and increasing an additional broadcast coverage range, so that the broadcast storm can be reduced; and updating the neighbor information table in real time in the mutual communication process of any two nodes, and performing broadcast communication on all nodes in the network by adopting the method until all nodes do not need to forward broadcast packets.
The invention has the following beneficial effects:
(1) the invention can effectively inhibit the broadcast storm. According to the characteristic that straight roads and intersections alternately appear in urban roads, the forwarding mode is divided into a straight road scene forwarding mode and an intersection scene forwarding mode, the roads are divided into regions according to directions in each mode, and nodes with the farthest distance are selected in each direction region to serve as next hop forwarding nodes. The current node determines the next skip forwarding node according to the grasped information, so that the number of nodes participating in broadcast packet forwarding can be reduced, the repeated forwarding times are reduced, the number of forwarding nodes is greatly reduced, and the broadcast storm is effectively inhibited.
(2) The average end-to-end delay of the invention is lower. In the method, the current node selects the neighbor node with the farthest distance in different directions as the next hop transmission node in the hop range of the current node, so that the overlapping area of the wireless coverage between the current node and the next hop transmission node is the smallest, and the additional broadcast coverage of the next hop node is increased; because the areas where the forwarding nodes are located are different, the collision is also reduced; and the nodes participating in forwarding become fewer, and the broadcast packet can cover the whole network through fewer nodes; these all reduce the average end-to-end delay to some extent.
Drawings
FIG. 1 is a broadcast flow diagram of the present invention;
FIG. 2 is a flow chart of the straight-path scenario forwarding mode of the present invention;
FIG. 3 is a schematic diagram of a straight-path scenario of the present invention;
FIG. 4 is a flow chart of an intersection scenario forwarding mode of the present invention;
FIG. 5 is a schematic diagram of a generic intersection scenario of the present invention;
FIG. 6 is a schematic view of a T-junction scenario of the present invention;
FIG. 7 is a schematic view of a turn intersection scene of the present invention;
FIG. 8 is a schematic view of a roundabout intersection scene of the present invention;
FIG. 9 is a flow chart of a source node sending broadcast packets in accordance with the present invention;
FIG. 10 is a flow chart of any node of the present invention receiving and forwarding broadcast packets;
FIG. 11 is a flowchart of the present invention for deleting a node entry in the table after the timeout period expires;
FIG. 12 is a diagram illustrating an example format of a neighbor information table in the present invention;
fig. 13 is a diagram illustrating an example format of a broadcast packet reception record table in the present invention.
Detailed Description
The invention is further described with reference to the following figures and detailed description.
As shown in fig. 1, a broadcast flowchart of the present invention specifically includes the following steps:
step 100, the source node sends a broadcast packet: the node i is any source node generating broadcast grouping in the network, firstly, whether a neighbor node exists in a neighbor information table of the source node i is judged, if not, 4 same special addresses (254.255.255.255) are used as forwarding node addresses; if yes, further judging whether the source node i is located in a straight road scene or an intersection scene, if so, adopting a straight road scene forwarding mode, and if not, adopting an intersection scene forwarding mode;
then writing the address of the source node i, the broadcast packet serial number, the broadcast destination IP address, the address of the current node i, the position coordinate of the current node j, the forwarding node address and the position state of the current node j into the head of the broadcast packet, and sending the broadcast packet;
step 200, any node j in the network receives and forwards the broadcast packet: when any node j receives a broadcast packet from the previous hop node h, sequentially judging whether the broadcast packet is received from the node h for the first time or not and whether the broadcast packet is received for the first time or not, and then performing corresponding processing;
step 201, firstly, judging whether node j receives broadcast packet from previous hop node h for the first time, if yes, establishing item of node h in neighbor information table of node j, and converting position coordinate (x) of node hh,yh) And writing the broadcast coefficient into the entry and writing the timeout time T corresponding to the node h1,T1Is 5s, the process goes to step 202; if not, updating the position coordinate (x) of the node h in the neighbor information tableh,yh) And a timeout period T1Turning to step 202;
step 202, judging whether a broadcast receiving and transmitting record table of the node j has a record received by the broadcast packet according to the IP address of the source node in the received broadcast packet and the serial number of the broadcast packet, if so, indicating that the broadcast packet is not received for the first time, turning to step 400; if not, it indicates that the broadcast packet is received for the first time, then add the received record of the broadcast packet in the broadcast transceiving record table of the node j, then judge whether all the 4 forwarding node addresses of the header of the received broadcast packet are special addresses (254.255.255.255), if yes, the node j forwards the broadcast packet with the probability of 0.5; if not, judging whether the address of the node j is in a forwarding node address list of the head of the broadcast packet, if so, selecting a corresponding forwarding mode to forward the broadcast packet by the node j according to the position states of the node j and a previous hop node, and turning to the step 400; if not, discarding the broadcast packet (all data of the broadcast packet are discarded), and go to step 400;
step 300, if the corresponding timeout T is under the previous node h entry in the neighbor information table of the node j1Counting time, namely that the information of the node h in the neighbor information table is not refreshed in the time, the neighbor node h has not sent a broadcast packet for a long time and is not a neighbor of the node j, and deleting the entry corresponding to the node h in the neighbor information table of the node j;
in step 400, all nodes in the network repeatedly and alternately perform steps 100 to 300 until all nodes do not need to forward the broadcast packet any more.
As shown in fig. 2, the method for selecting forwarding nodes in a straight-path scenario forwarding mode of the present invention includes the following steps:
firstly, a straight road scene diagram is shown in fig. 3, a vertical foot from a node j to a solid line in the center of a road is taken as a circle center, a horizontal straight road takes a horizontal straight road direction as a positive direction of an x axis and is taken as a reference of an angle of 0 degree, a vertical straight road takes a vertical straight road as a positive direction of a y axis and is taken as a reference of an angle of 0 degree, a counterclockwise direction is taken as an angle increasing direction, and a road area of the straight road scene is divided into four areas E1、E2、F1、F2:
E1:(270°,360°];E2:(0°,90°]
F1:(90°,180°];F2:(180°,270°];
Secondly, according to the position coordinate (x) of the q-th adjacent node in the node j neighbor information tablejq,yjq) And the position of the center of the circle (x)o,yo) Calculating the distance d between the qth adjacent node and the center of the circlejqThe angle value omega of the connecting line of the qth adjacent node and the circle centerjq(q=1,2,3……n)。
③ according to omegajq(q ═ 1,2,3 … … n), it is determined to which region all neighboring nodes belong, and region labeling is performed on all neighboring nodes.
Fourthly at E1And selecting the node farthest from the circle center in the area as a forwarding node. If E1If the area has no adjacent node, then in E2And selecting the node farthest from the circle center in the area as a forwarding node. If E2Same in the regionIf there is no neighboring node, it means E1And E2The area has no neighbor node, the next hop forwarding node cannot be selected, and the forwarding node address is replaced by a special address (254.255.255.255) for the purpose of unifying the broadcast packet format.
Fifthly, in F1And selecting the node farthest from the circle center in the area as a forwarding node. If F1If the area has no adjacent node, then F2And selecting the node farthest from the circle center in the area as a forwarding node. If F2If there is no adjacent node in the region, it represents F1And F2The area has no neighbor node, the next hop forwarding node cannot be selected, and the forwarding node address is replaced by a special address (254.255.255.255) for the purpose of unifying the broadcast packet format.
And sixthly, finishing.
As shown in fig. 4, the method for selecting forwarding nodes in an intersection scene forwarding mode of the present invention includes the following steps:
firstly, as shown in fig. 5, 6, 7 and 8, the intersection scene is that four corner vertex positions m of the intersection road are known and sorted along the reverse clock1、m2、m3And m4Connecting the vertex of the corner with a line m1m3Connecting line m with corner vertex2m4The intersection point of the two-way lane is taken as the center of a circle, the positive direction of the x axis is taken as the reference of 0 degree of angle, the anticlockwise direction is taken as the direction of increasing angle, and the center of a circle is respectively taken as the connecting line of the tail end of the solid line between the two-way lanes on each road and the connecting line m of the vertex of the corner1m3、m2m4Dividing intersection area into eight areas A1、A2、B1、B2、C1、C2、D1And D2By comparing the position coordinates (x) of the kth neighbor node in the neighbor information table of node jjk,yjk) At the position and eight areas A1、A2、B1、B2、C1、C2、D1And D2The relationship between the eight regions determines to which of the eight regions the neighboring node belongs;
secondly, according to the position coordinate (x) of the q-th adjacent node in the node j neighbor information tablejq,yjq) And the position of the center of the circle (x)o,yo) Calculating the distance d between the qth adjacent node and the center of the circlejqThe angle value omega of the connecting line of the qth adjacent node and the circle centerjq(q=1,2,3……n)。
③ according to omegajq(q ═ 1,2,3 … … n) determines to which area all neighboring nodes belong, and area labels are made to all neighboring nodes.
Fourthly, at A1And selecting the node farthest from the circle center in the area as a forwarding node. If A1If there is no adjacent node in the area, then it is at A2And selecting the node farthest from the circle center in the area as a forwarding node. If A2If there is no adjacent node in the region, it represents A1And A2The area has no neighbor node, the next hop forwarding node cannot be selected, and the forwarding node address is replaced by a special address (254.255.255.255) for the purpose of unifying the broadcast packet format.
Fifthly, in B1And selecting the node farthest from the circle center in the area as a forwarding node. If B is1If there is no adjacent node in the area, then it is in B2And selecting the node farthest from the circle center in the area as a forwarding node. If B is2If there is no adjacent node in the region, it represents B1And B2The area has no neighbor node, the next hop forwarding node cannot be selected, and the forwarding node address is replaced by a special address (254.255.255.255) for the purpose of unifying the broadcast packet format.
Is at C1And selecting the node farthest from the circle center in the area as a forwarding node. If C1If there is no adjacent node in the area, then it is at C2And selecting the node farthest from the circle center in the area as a forwarding node. If C2If there is no adjacent node in the region, it represents C1And C2The area has no neighbor node, the next hop forwarding node cannot be selected, and the forwarding node address is replaced by a special address (254.255.255.255) for the purpose of unifying the broadcast packet format.
Is at D1And selecting the node farthest from the circle center in the area as a forwarding node. If D is1If there is no neighboring node in the region, then D2Selecting the node farthest from the circle center in the regionAs a forwarding node. If D is2If there is no neighboring node in the region, D is represented1And D2The area has no neighbor node, the next hop forwarding node cannot be selected, and the forwarding node address is replaced by a special address (254.255.255.255) for the purpose of unifying the broadcast packet format.
And finally (8) ending.
As shown in fig. 9, the method for transmitting a broadcast packet by a source node of the present invention includes the following steps:
firstly, adding a record received by a broadcast packet in a broadcast packet receiving record table of the node i, then judging whether the node i has a neighbor information table, if not, writing 4 same special addresses (254.255.255.255) in a forwarding address list of the broadcast packet, and turning to step two; if yes, further judging whether the source node i is in a straight road scene or an intersection scene, if so, selecting a next skip transmitting node in a straight road scene forwarding mode, and turning to the second step; if the node is in the intersection scene, selecting a next skip sending node by adopting an intersection scene forwarding mode, and turning to the second step;
writing the address of a source node i, the broadcast packet serial number, the broadcast destination IP address, the address of a current node i, the position coordinate of a current node j, the address of a forwarding node and the position state of the current node j into the head of the broadcast packet, and sending the broadcast packet;
and thirdly, finishing.
As shown in fig. 10, the method for receiving and forwarding a broadcast packet by any node of the present invention includes the following steps:
after receiving the broadcast packet forwarded by the previous-hop neighbor node h, the node j firstly judges whether the broadcast packet is received from the node h for the first time:
if yes, establishing a neighbor information item of the node h in a neighbor information table of the node j, and broadcasting the position coordinate (x) of the node h in the packet headerh,yh) Storing the entry and writing the timeout T in the corresponding position of the entry1Turning to step two;
if not, updating the middle section of the neighbor information tablePosition coordinate (x) of point hh,yh) And a timeout period T1Turning to step two;
judging whether the broadcast packet receiving record table of the node j has a record that the broadcast packet has been received:
if yes, discarding the broadcast packet, and turning to sixth;
if not, adding the received record of the broadcast packet in a broadcast packet receiving record table of the node j, and turning to step three;
judging whether 4 forwarding addresses in the broadcast packet are all special addresses:
if not, judging whether the node j is in the forwarding node address:
if not, the node j does not need to forward the broadcast packet, discards the broadcast packet and turns to the sixth step;
if yes, indicating that the node j needs to forward the broadcast packet, and turning to the fourth step;
if all the addresses are special addresses, forwarding is carried out according to the probability, wherein the forwarding is carried out according to the probability of 0.5, and the specific method comprises the following steps: node j generates a uniformly distributed random number alpha,
if alpha is greater than 0.5, the broadcast packet is discarded, and the process goes to step (c);
otherwise, the node j needs to forward the broadcast packet and turns to the fourth step;
determining different forwarding modes by the node j according to the position states of the node j and the previous hop node h, namely the node j is positioned in a straight road scene or a crossing scene, and selecting the next hop forwarding node:
if the previous hop node h is positioned in a straight road scene and the previous hop node h is positioned in the straight road scene, adopting a straight road scene forwarding mode, removing the direction area of the previous hop node h, selecting a next hop forwarding node on another road area in the same node driving direction, and turning to a fifth step;
if the previous hop node h is located in a straight road scene and is located in an intersection scene, the node j needs to select the next hop forwarding node in different directions of the intersection, so that an intersection scene forwarding mode is adopted, the road area where the previous hop node h is located is removed, the next hop forwarding node is selected in the remaining three road areas, and the vehicle turns to a fifth step;
if the previous hop node h is located in the intersection scene and if the previous hop node h is located in the intersection scene, the node j is the selected next hop forwarding node located in different directions of the intersection, and at the moment, the node j does not need to select the next hop forwarding node in different directions of the intersection but adopts a straight-path scene forwarding mode; if the node j is located in the straight road scene, it is explained that the node j forwards on the straight road next time, and then the straight road scene forwarding mode is also adopted, so in summary, if the previous hop node h is located in the intersection scene, the position state of the node j does not need to be judged, and the straight road scene forwarding mode is directly adopted; in both cases, the next jump starting node is selected in the driving direction area of the node j, and the vehicle turns to a fifth step;
the node j writes the source node address of the broadcast packet, the serial number of the broadcast packet, the destination IP address of the broadcast packet, the address of the current node j, the position coordinate of the current node j, the address of the next hop forwarding node and the position state of the current node j into the head of the broadcast packet to be forwarded, and sends the broadcast packet;
end of
As shown in fig. 11, the method for deleting a node entry in a neighbor information table of the present invention includes the following steps:
if the overtime time T in the node k entry in the neighbor information table of the node j1If timing is up, deleting the entry corresponding to the node h in the neighbor information table of the node j; and (6) ending.
As shown in fig. 12, an example format of the neighbor information table in the present invention specifically includes:
IP address (node: j): represents the IP address of the current node j;
information of q-th neighbor node of j, where n is 1,2, …, n, including:
IP address(node:jq): the IP address of the qth neighbor node representing node j;
(xjq,yjq): position coordinates of the q-th neighbor node representing node j, where xjqAbscissa, y, representing the q-th neighbor nodejqRepresents the ordinate of the qth neighbor node;
T1: and the initial value of the timeout time of the q-th adjacent node of the node j is the same and is 5 s.
If the time-out time T1And when the time is up, the entry of the adjacent node k in the neighbor information table of the node j is not refreshed, the adjacent node is considered not to be the adjacent node of the current node j, and the entry of the adjacent node k is deleted from the neighbor information table of the current node j. The time-out time T will be after each recording and refreshing1Set to an initial value.
As shown in fig. 13, an example format of the broadcast transceiving record table in the present invention specifically includes:
IP address (current node: j) is the IP address of the current node j;
the packet condition that the broadcast packet sequence number sent by the source node i is x specifically includes:
IP address (source node: i) the IP address of the source node i;
packet sequence number x (from source node i) sending out a broadcast Packet with sequence number x from source node i;
T2: the overtime time of each broadcast packet is used for deleting the overtime entry in the broadcast packet acceptance record table after the overtime time is up, and updating the broadcast packet acceptance record table T in real time2The initial value was 30 s.
Be received (Yes or No): indicating whether the broadcast packet has been received, Yes indicating received and No indicating not received.
The packet condition that the broadcast packet sequence number sent by the source node m is y specifically includes:
IP address (source node: m) the IP address of the source node m;
packet sequence number y (from source node m) from source node m, sending out broadcast Packet with sequence number y;
T2: a timeout period for each broadcast packet for deleting the timeout entry in the broadcast packet reception record table after the timeout period expires, updating the broadcast packet reception record table in real time, T2The initial value was 30 s.
Be received (Yes or No): indicating whether the broadcast packet has been received, Yes indicating received and No indicating not received.
And so on.
According to the flow of the embodiment, the program code of the protocol method can be written, and the code can be applied to the broadcast of the vehicle ad hoc network after being successfully compiled. In order to better embody the performance improvement of the protocol method, the protocol method is simulated by network simulation software.
The method of the invention mainly analyzes from three performance indexes: (1) ratio of forwarding Nodes (Ratio of forwarding Nodes): in the simulation process, the number of nodes participating in forwarding the broadcast packet accounts for the total number of nodes in the network. (2) Average End-to-End Delay (Average End-to-End Delay): the average of the delays from when the source node sends out a broadcast packet until the broadcast packet is received by all destination nodes. (3) Arrival rate (availability): the ratio of the number of broadcast packets actually received by all destination nodes to the number of broadcast packets that all nodes should have received.
In order to better see the advantages of the protocol method of the invention, the method DDBB of the invention is compared with three protocol methods, namely DRIVE and flood. The driving protocol method calculates the angle value of the connecting line between the adjacent node and the circle center according to the position information between the driving protocol method and the adjacent node, and then endows the adjacent node with different delay time according to different angle values. The Flooding algorithm is a special probability-based broadcast algorithm, and the forwarding probability of each node is 1, that is, each node receives a broadcast packet for the first time and forwards the broadcast packet to nodes in a one-hop range.
The simulation is carried out on the condition that the number of the nodes in the network is different from the packet sending rate of the source node.
(1) The forwarding node proportion of the DDBB method in the invention is far smaller than that of the DRIVE and Flooding protocols.
(2) The average end-to-end delay of the DDBB method in the invention is obviously smaller than that of the DRIVE and Flooding protocols.
(3) The DDBB method of the present invention had the best stability of arrival rate compared to the other 2.
According to simulation result analysis, the method has advantages in forwarding node proportion and average end-to-end delay, can well inhibit broadcast storm, improve reliability, and can adapt to urban road scenes of high-speed movement of nodes.
It should be understood that this example is for illustrative purposes only and is not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.