|
Algorithm 1 The Process of MD-MAC. |
Input: node , the previous neighbor , the following neighbor , time stamp K
Output: Initialization
Each node initializes its time stamp //add the time stamp
For
t=1 to
T
While
2 //the first two period, collecting neighbors information
Each node transmit with its neighbors and build its
neighbor table
endwhile
If
then //start to adjust
For
i=1 to
N
If
then
send fire packet broadcast //reach the firing point
else //adjust phase according to different cases
If in case 1 & = 0 then
adjusts its phase to
endIf
If in case 2 & &
then
( means one-hop neighbor and means
two-hop neighbor)
adjusts its phase to
endIf
If in case 3 &
&
then
adjusts its phase to
endIf
endIf
endFor
endIf
Each node has occupied a period of the frame //success to occupy time slots
// Conflict detection process
If the collision occurs between nodes and in the one-hop then //punching
and calculate the punching frame based on and
In next period
and keep listening in the frame they select
else
the collision occurs between nodes and in the two-hop //neighbor detection
is the junction node of and
send collision-warning packet to and backs off
endIf
endFor
|