Research Article

Efficient Channel Selection and Routing Algorithm for Multihop, Multichannel Cognitive Radio Networks with Energy Harvesting under Jamming Attacks

Algorithm 1

Multihop channel allocation scheme under attack in the physical layer.
(1) Input:  , , , , , , , .
(2) Output:  Obtain the best choice .
(3) Find , as Eq. ((7)–(10)).
(4) Find a set of possible choices , .
(5) Define a set of energy harvesting cases , , .
(6) Define a set of energy harvesting probability cases , , .
(7) for    do
(8) for    do
(9) Initialize remaining energy of relays with the initial energy at the frame time index .
(10) for    do
(11) Update energy of relays.
(12) if      // Energy of all relays in chosen route is sufficient.
(13) Calculate as Eq. (13).
(14) else
(15) Define a set of insufficient-energy relays in allocated route .
(16) Calculate required energy of relays in , as Eq. (14).
(17) Calculate successful recovery probability of each relays in allocated route as Eq (15).
(18) Calculate successful recovery probability of allocated route as Eq. (16).
(19) Calculate expected throughput for frame , as Eq. (17)
(20) end if
(21) Calculate delay time .
(22) Calculate throughput/delay ratio as Eq. (18).
(23) Calculate remaining energy of relays as Eq. (4).
(24) end for
(25) end for
(26) Define the best index , with .
(27) end for
(28) Define the best index , with .