Research Article
A Lightweight Neighbor-Info-Based Routing Protocol for No-Base-Station Taxi-Call System
Algorithm 1
Algorithm of taxi node.
Initialization ; | Initiate the prediction position ; | Initialization ; | Set timer; | Timer_task(){ | Obtain the current position L, speed V, time | ; | If (no-load){ | ; | } | Calculate prediction position at () | If (≥){ | | broadcast(L, V, H, ); | ; | | }else if ( larger than threshold 0){ | | broadcast(L, V, H, ); | ; | ; | } | For each node q in table{ | get q's prediction time | if (state(q) active && ){ | state(q) = inactive; | if (q have the link ID){ | send to other node which have the same lnik ID as q; | } | } | If ( 2){ | Remove q from table; | } | } | Update H; | } | Count = 0; // reset 0 after passengers getting off or appointment cancellation | Block_listen(Message){ | Switch typeof(Message) { | Case : | update table | update H | if q node that sends gets out of the communication range, and it has link ID in the table | send to other node | which have the same link ID as q; | break; | Case : | If (){send back} | break; | Case : | If (Message Reserve){ | If ( && count 0){ | Count = 1; | send (Agree or Disagree) back; | }else if (){ | Set link ID; | send to all q in table which ; | }else{ | Set link ID; | send to one q which ; | } | } | Case : | If (Message Agree){ | Send forward to q which | and have the same link ID; | delete link ID; | } | If (){ | Send Confirm back; | } | Default: | } | } |
|