Research Article

Alert: An Adaptive Low-Latency Event-Driven MAC Protocol for Wireless Sensor Networks

Algorithm 2

Procedure getโ€‰P ( ๐‘› , ๐‘€ ) .
(1) for each frame ๐‘ก โ€‰โ€‰do
(2)โ€ƒCalculate (and store) ๐ฉ ( ๐‘ก ) for the given ๐‘€ with
โ€ƒโ€ƒcurrent value of ๐‘› usingโ€‰โ€‰(51)
(3)โ€ƒReduce ๐‘› by expected no. of messages read so far,
โ€ƒโ€ƒ that is,
โ€ƒโ€ƒ ๐‘› = ๐‘› โˆ’ ๐”ผ ( ๐‘… ๐‘› )
(4)โ€ƒif ๐‘› โ‰ค ๐‘ t h r โ€‰โ€‰then
(5)โ€ƒโ€ƒStore number of frames ๐น = ๐‘ก + 1
(6)โ€ƒโ€ƒRepeat last ๐ฉ ( ๐‘ก ) , that is, ๐ฉ ( ๐น ) = ๐ฉ ( ๐‘ก ) .
(7)โ€ƒโ€ƒBreak from for loop
(8)โ€ƒend if
(9) end for
(10) Return ๐น and ๐ = ( ๐ฉ ( 1 ) ; โ€ฆ ; ๐ฉ ( ๐น ) )