# Image Transmission over Cognitive Radio Networks for Smart Grid Applications
## 3 Proposed MAC Layer for Image Streaming over CRSNs
### The Average Time Overhead Due to Retransmission  
To estimate the average time overhead due to the retransmission, the user arrival model must be applied. Considering the Poisson arrival model with the arrival rate \(\lambda_{p}\) for primary users and subsequently taking into account the time interval exponential distribution, the probability function \(P(X^{i}\geq x)\) is expressed in terms of the following Equations (4) and (5) [60; 72; 84; 85]:  
\[\left\{ \begin{array}{l}P\{X^{i}\geq x\}=L_{i}^{x},x=0,1,2,\ldots X\\ L_{i}=L_{i}^{1}=(1-P_{f})e^{-\lambda_{i}t_{p}^{i}}\end{array} \right. \tag{4}\]  
So it can be written as Equation (5) [60; 72; 84; 85]:  
\[P\{X^{i}=x\}=\left\{ \begin{array}{l}L_{i}^{x}-L_{i}^{x+1}\quad x<X\\ L_{i}^{x}\quad x=X\end{array} \right. \tag{5}\]  
If we have \(X^{i}\) transmissions is in the \(i\)'th channel, then the Actual Transmission Time in the channel \(t_{ATT}^{i}\), is equal to \(X^{i}t_{p}^{i}\) that we should have: \(t_{ATT}^{i}\leq D_{m}\) and \(t_{ATT}^{i}\leq\tau_{l}\) where \(\tau_{l}\) is the time it takes to transfer \(I_{b}\) bits at the rate \(R_{b}\) in an ideal channel. Given the Equation (3), we want to evaluate the weights of both parameters \(T_{s}\) and \(\tau_{P}^{i}\) on the total overhead time. For this purpose, we consider the probability function \(P_{Ar}^{PU,X}(X^{i})\) as the probability of a secondary user arrival in \(X^{i^{\prime}}th\) iterations:  
\[P_{Ar}^{PU,X}(X^{i})P(X\geq X^{i})=(1-P_{fa})^{X^{i}}exp(-\lambda_{i}X^{i}( \tau_{P}^{i}+T_{S})) \tag{6}\]  
Based on this definition, if a PU arrival does not occur during the sending of the packet, the time overhead on the channel is just related to the spectrum sensing and will be equal to \(X^{i}T_{s}\) while if the new spectrum sensing process detects a PU arrival into the existing channel \"\(i\)\", then the last packet will need to be retransmitted. The latency in this state is equal to \(X^{i}T_{s}+\tau_{p}^{i}\). According to the presented \begin{table}
\begin{tabular}{c c c} \hline
**Symbol** & **Descriptions** & **Value/Application/Method** \\ \hline \(I_{b}\) & Image frame Payload & \(I_{b}=rcdn,r=c=512,d=3\) \\ \hline \(D_{m}\) & Maximum tolerable delay & Variable parameter \\ \hline \(T_{s}\) & Spectrum sensing time duration & \(T_{s}=0.01s/EnergyDetection\) \\ \hline \(P_{M}\) & Misdetection probability & \(P_{M}=0\) \\ \hline \(P_{c}\) & Correct detection probability & \(P_{c}=1\) \\ \hline \(P_{f}\) & False alarm probability & \(P_{f}=0.01\) \\ \hline S & Number of channels in spectrum pool & Variable parameter \\ \hline \(\mu_{i}\) & Average time arrival of primary users in \(i\)th channel & Variable parameter \\ \hline \(\lambda_{i}\) & Average time arrival of primary users in \(i\)th channel & Variable parameter \\ \hline \(\tau_{P}^{i}\) & Time length of the sending packet in \(i\)th channel & Optimization parameter \\ \hline \(X^{i}\) & Spectrum sensing iterations in \(i\)th channel & Optimization parameter \\ \hline \(\tau_{O.H}\) & Time overhead due to spectrum sensing and retransmission & Objective function \\ \hline \(t_{ETT}^{i}\) & Effective transmission time in \(i\)th channel & Objective function \\ \hline \end{tabular}
\end{table} 
Table 3: List of parameters that were used in the proposed Media Access Control (MAC) layer. description, the overhead time of spectrum sensing and retransmission for the current channel can be modeled as follows:  
\[\tau_{OH}^{i}=(X^{i}T_{s}+\tau_{P}^{i})P_{Ar}^{PU,X}(X^{i})+(X^{i}T_{s})(1-P_{Ar }^{PU,X}(X^{i})) \tag{7}\]  
With consideration \(P_{Ar}^{PU,X}(X^{i})=g(t_{P}^{i},X^{i},\lambda_{i},P_{fa},T_{S})\) we have \(\tau_{OH}^{i}=X^{i}T_{s}+\tau_{P}^{i}g(t_{P}^{i},X^{i},\lambda_{i},P_{fa},T_{S})\). Now, we should estimate the average of time overhead:  
\[E(\tau_{OH}^{i})=E(X^{i})T_{s}+\tau_{P}^{i}E(g(t_{P}^{i},X^{i};\lambda_{i},P_{ fa},T_{S})) \tag{8}\]  
According to the Equation (8), we need to extract the relationships for \(E(X^{i})\) and \(E(g(t_{P}^{i},X^{i},\lambda_{i},P_{fa},T_{S}))\).