## 6 Simulation and Results
### The Convergence of MAB  
The simulation is conducted within a cluster of a cognitive radio sensor network. Suppose the authorized users are in the network system, every channel has only two kinds of state S, which are named as two Gilbert-Elliott Markov chain values as shown in Table 4 and Figure 11.  
\begin{table}
\begin{tabular}{c c} \hline
**Type** & **Description** \\ \hline S = 1 & the current channel free \\ S = 0 & the current state of busy \\ \(\lambda_{0}\) & the channel state transition probability from busy to idle \\ \(1-\lambda_{1}\) & the channel state transition probability from idle to busy \\ \hline \end{tabular}
\end{table}
Table 4: Parameters of Gilbert-Elliott Markov chains.  
Figure 10: The time interval of ACK.  
Figure 9: Bandwidth estimation.  
The whole wireless network simulation parameters are shown in Table 5.  
Because the frame error rate is dependent on the packet size, the number of data sent according to the channel quality at any time should be revised. In Figure 12, the channel quality is divided into good channel, normal channel and bad channel. When the wireless network quality is bad, the optimal packet size is 40 bytes. When the channel quality is normal, the optimal packet size is 60 bytes. When the channel quality is good, the optimal packet size is 100 bytes. When the optimal packet size is transmitting and receiving, the energy consumption is the least. It can be concluded that there is always the optimal packet size for any channel state.  
Figure 11: G-E Channel Model.  
Figure 12: The optimal packet size in the different channel states.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Value** \\ \hline Number of sensors (N) & 30 \\ Number of channels (M) & 20 \\ Sensor active probability & 0.3 \\ Channel transition probability & (0.1) \\ Slot duration (ts) & 4 ms \\ Data transmission rate (B) & 40 kbps \\ CM control packet size (L) & 17 bytes \\ CH broadcast packet size (L) & 20 bytes \\ CM data packet size (L) & 20\(\sim\)128 bytes \\ Sensor initial energy (\(\,E_{in}\,\)) & 1 J \\ RF circuit energy consumption (\(\,E_{cr}\,\)) & 50 nJ/bit \\ Amplifier energy required at CH (\(\,\varepsilon\,\)) & 100 PJ/bit \\ Distance between sensor and CH (d) & 25 m on average \\ \hline \hline \end{tabular}
\end{table}
Table 5: all the parameters used in the simulation [52, 53, 54, 55].  
The paper maps packet size adaptation to the different arms. When the channel transmission probability is unknown, the challenge of searching the optimal packet size strategy is that the arm is infinite. In order to solve this problem, this paper makes use of sender monitoring ACKs to estimate the bandwidth. When the channel quality is bad, the packet size is between 20 and 50. When the channel quality is normal, the packet size is between 50 and 90. When the channel quality is good, the packet size is between 90 and 120. Figure 13 shows he capability of all arms with the normal wireless network quality for the multi-armed bandits algorithm.  
The arm 60 is the optimal arm for the wireless network quality, and arm 60 is chosen to reach to 100% with increasing implementation time, otherwise the other arm chosen reaches 0%. The same method can obtain the corresponding optimal arm under the good and bad wireless network quality conditions. As shown in Figure 14, the convergence of the corresponding optimal arm can be obtained with different wireless network quality. As seen in the figure, as the implement time increases, the optimal arm was chosen to run longer then gradually reaches 100%.  
Figure 14: The optimal arm for the different wireless network quality.  
Figure 13: The optimal arm for the same wireless network quality.