Head Meter Countdown: Each meter counts
down from 30 * MN where MN is its Meter Number. Whichever meter reaches
zero first will become the initial head meter. This is shown in the
Figure 5: Head Meter Countdown Thread
Routing Table Update: Once every cycle this
thread will update the Link Qualities and Hop Value for each non-zero
entry in the routing table.
Update Packet Send: Whenever an update
packet needs to be sent, this thread will be invoked by sending it an
alarm signal. The diagram below shows the stages involved in sending an
Figure 6: Update Packet Send Thread
Data Packet Send: This thread is
responsible for sending the data packets at the scheduled time. It is
invoked whenever there is a new head meter, indicating the start of a new
data collection cycle.
Data Fusion: This thread constantly listens
on the data port for data packets. It collects all information directed at
the meter. Moreover, with some probability, it collects information not
directed at it. This thread also listens for probability packets and
updates the probability matrix when it receives one of these probability
Print Table Thread: This writes the routing
table to a file whenever it is updated. This was done as a separate thread
instead of executed as a function within another thread in order to
increase the degree of parallel processing.
Updates and Control: This thread listens
for update packets, updates the routing table when new information becomes
available and reacts to the update packets by waking other threads as
needed. The diagram below shows how update packets are handled.
Figure 7: Updates and Control Thread