Node x receives routing information and a schedule from the BS.
Synchronization.
while 1 do
if node x is in sleeping period. then
  sleep until working period starts.
end if
if abnormal events happen. then
  request x’s parent to wait for data in sleeping period.
end if
    if receive data from x’s children. then
  receive the data as scheduled.
    end if
    if  x has data to send. then
  send the data in working period as scheduled.
    end if
end while
Algorithm 3: RAS protocol at the other nodes (it runs at each sensor node after the initialization).