Skip to main content
. 2020 Feb 29;20(5):1338. doi: 10.3390/s20051338
Algorithm 1. Method of Relay-Node Selection on Curved Roads
1 Input: Set of Nodes N, Obstacles Ο.
2 Input: Message sender S, previous sender Spre, terminal point Pend.
3 Output: Relay-node on curved roads.
4 Phase 1. Judgment Phase:
5 if there is an area between S and Spre that is blocked by Ο or out of the communication range of S and Spre.
6   Determine the area as a vacant.
7 Phase 2. RTB Packet Broadcast Phase:
8 if there is a vacant between S and Spre
9   Set the mode flag of RTB packet to 3 (means simultaneously start the normal selection and the reverse selection).
10   Determine the optimal position Popt_norm in the message propagation direction according to Definition 1.
11   Choose the nearest corner as the optimal position Popt_rev in the reverse direction.
12   Determine the endpoint of the vacant closest to Spre as the termination of the reverse selection Prev_end.
13   Add Popt_norm, Popt_rev, Prev_end into the RTB packet.
14 else if be on the road between S and Spre.
15   Set the mode flag of RTB packet to 2 (means start the reverse selection).
16   Choose the next corner as the optimal position Popt_rev in the reverse direction
17   Update Popt_rev in the RTB packet.
18 Else
19   Set the mode flag of RTB packet to 1 (means start the normal selection).
20   Determine the optimal position Popt_norm in the message propagation direction according to Definition 1.
21   Update Popt_norm in the RTB packet.
22  Broadcast the RTB packet.
23 Phase 3. Relay-Node Selection Phase:
24 if the mode flag of RTB packet is 3
25   Start EPBP with Popt_norm as the optimal position, nnormN is not blocked by Ο is selected as the relay-node in the message propagation direction.
26   Simultaneously, start EPBP with Popt_rev as the optimal position, and nreverN is not blocked by Ο is selected as the relay-node in the reverse direction.
27 else if the mode flag of RTB packet is 2
28   Start EPBP with Popt_rev as the optimal position.
29   nreverN is not blocked by Ο is selected as the relay-node.
30 Else
31   Start EPBP with Popt_norm as the optimal position.
32   nnormN is not blocked by Ο is selected as the relay-node.
33 Relay-node selection finished