Research Article
Trust-Aware and Low Energy Consumption Security Topology Protocol of Wireless Sensor Network
Algorithm 2
The pseudocode of weighted spanning tree.
| ) if round = 1 | | () Bs_str = Receive_Str(msg form BS) //radio strength from BS | | () endif | | () if (().energy > 0 && ().type! = “”) | | () if (().distanceToSink < ().distanceToSink && (). > 0 && ().type! = “”) | | () choose max(* distance/ + * Ecurrent/Eo + * (max_degree − degreei)/max_degree) as next node | | () ().nextnode = ; | | () degree += degree //updated the next-hop node’s degree | | () broadcast _MSG within range ; | | () end if; | | () end for | | () for (All nodes whose residual energy are greater than 0) | | () Node Send TDMA table to it’s connected node; | | () nodes have connected to the node receives the TDMA | | () end for |
|