Research Article

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

Algorithm 3

Procedure g e t 𝑀 ( 𝑁 g u e s s ) .
(1) Use timing constants 𝜏 1 and 𝜏 2 of specific radio used
(2) for each 𝑀 𝑀 m a x   do
(3)  𝜏 s l o t ( 𝑀 ) = 𝑀 𝜏 1 + 𝜏 2
(4) Get the expected number of frames needed, 𝐹 ( 𝑀 ) ,
   based on value of 𝑁 g u e s s :
    𝐏 , 𝐹 ( 𝑀 ) = g e t 𝐏 ( 𝑁 g u e s s , 𝑀 )
(5) end for
(6) Get optimal 𝑀 for reading all messages:
    𝑀 t e m p = a r g m i n 𝑀 𝐹 ( 𝑀 ) × 𝜏 s l o t ( 𝑀 )
(7) Get associated time to read all messages:
    𝑡 𝑀 t e m p v a l = 𝐹 ( 𝑀 t e m p ) × 𝜏 s l o t ( 𝑀 t e m p )
(8) Find largest 𝑀 within some factor 𝛽 of 𝑡 𝑀 t e m p v a l :
    𝑀 o p t = m a x { 𝑀 | 𝑡 𝑀 v a l ( 1 + 𝛽 ) 𝑡 𝑀 t e m p v a l }
(9) Return 𝑀 o p t