|
| Algorithm 1: Post emergency messages |
|
|
Input:
mi, ei, k, Ek,Mk, |
|
mi: |
the size of emergency the message needed to be posted |
|
ei: |
the approximated energy consumption of receiving the emergency message. |
|
k: |
the number of Tibbo nearby victim i is k. |
|
Ek: |
the remaining energy capacity of the k-th Tibbo |
|
Mk: |
the remaining memory capacity of the k-th Tibbo |
| S: |
the selected Tibbo board |
|
| 1: |
Procedure Post
|
| 2: |
S = Null; |
| 3: |
for
j = 1 to k
do
|
| 4: |
if (S == Null) AND (Ej > ei ) AND (Mj > mi
) then
|
| 5: |
S = j; |
| 6: |
else if (S! = Null) AND (Ej > Es ) AND (Mj > mi ) then
|
| 7: |
S = j; |
| 8: |
end if
|
| 9: |
end for |
| 10: |
if S is not Null |
| 11: |
Connect to Tibbo board S; |
| 12: |
Post the emergency message on S; |
| 13: |
end if |
|