Initialization

Download Report

Transcript Initialization

Parameters: S – sleep duration; A – awake duration
Packet types:
Initialization
Data:
SYNC - contains sender’s address and time to next sleep
Type: Schedule: Node address, next time to wake-up
Variable: Array of Schedule - the size of the array depends on the density of the network
This node’s schedule
Didn’t hear a SYNC.
Wait and listen for SYNC
Heard SYNC
Set this node’s schedule to
match the received schedule
and set time to go to sleep
Set timer to random time = tr
Listen for SYNC
Record schedule
(leave this node’s schedule as is)
Heard SYNC
Timer expired
Broadcast SYNC
Record schedule
(leave this node’s schedule as is)
Listen for SYNC
Go-to-sleep timer expired
Set sleep duration timer
Go to sleep
Heard SYNC
Pick random time time to sleep
Normal Awake and listen
Woke-up
Set go-to-sleep time
Determine if SYNC should be sent.
-Pick a random number between 0 and 1
Record schedule
(leave this node’s schedule as is)
Random number > 0.5
Heard SYNC
Send SYNC
(no CS but wait a random time after wake-up)
Listen
Go-to-sleep-timer expired
Set timer to random value
(what should the range be?)
Record schedule
(leave this node’s schedule as is)
Set sleep duration time
Listen
timer expired
Sent SYNC
Go to sleep