Algorithm 1 CAD |
constantRate: select the desired transmission rate |
realRate: from Equation (6) |
fakeRate: from Equation (7) |
realIntervalCount: the maximum number of intervals a real packet can wait |
maxIntervalCount: the maximum number of intervals desired by the application |
randomSending: a random number between 0 and 1 |
for
< number of lifetime slots do
|
for each node in the network do
|
if node has a real packet in its buffer then
|
if
== sending interval then
|
if
maxIntervalCount == realIintervalCount
then
|
make realRate to 1 |
else make the rate equal to realRate |
end if
|
if randomSending realRate then
|
remove the packet from node’s buffer |
adjust sending time for other packets in buffer |
add partition to time slot |
run the desired routing protocol |
else
|
delay all packets in buffer and try next interval |
end if
|
else
|
if randomSending fakeRate then |
send a fake packet |
end if
|
end if
|
end if
|
end for
|
end for
|