# Detecting Jamming in Smart Grid Communications via Deep Learning
## 5 Theoretical Framework and Methodology
### Theoretical Framework
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Notation** & **Value** \\ \hline Transmit Power [dB\(\mathrm{\SIUnitSymbol}\)] & \(P_{\mathrm{T}}\) & 120 \\ \hline Noise Power [dB\(\mathrm{\SIUnitSymbol}\)] & \(P_{\mathrm{N}}\) & 70 \\ \hline Number of SC per OFDM Symbol & \(N_{\mathrm{SC}}\) & 512 \\ \hline FFT Size & \(N_{\mathrm{FFT}}\) & 512 \\ \hline Carrier Frequency [Hz] & \(F_{\mathrm{c}}\) & \(20\times 10^{6}\) \\ \hline Sub-Carrier Spacing [Hz] & \(\Delta_{f}\) & \(15\times 10^{3}\) \\ \hline OFDM Symbols per Frame & \(N_{\mathrm{spnd}}^{\mathrm{freq}}\) & 20 \\ \hline Sampling Time [s] & \(T_{\mathrm{spnd}}\) & \(1/(2\times F_{\mathrm{c}})\) \\ \hline OFDM Symbol Duration [s] & \(T_{\mathrm{spnd}}\) & \(N_{\mathrm{FFT}}\times T_{\mathrm{spnd}}\) \\ \hline Frame Duration [s] & \(T_{\mathrm{frame}}\) & \(N_{\mathrm{spnd}}^{\mathrm{freq}}\times T_{\mathrm{spnd}}\) \\ \hline Number of Frames & \(N_{\mathrm{frame}}\) & \([\mathrm{T_{\mathrm{sim}}}/T_{\mathrm{frame}}]\) \\ \hline Number of OFDM Symbols & \(N_{\mathrm{spnd}}\) & \(N_{\mathrm{frame}}\times N_{\mathrm{spnd}}^{\mathrm{freq}}\) \\ \hline Distance \(\mathcal{A}-\mathcal{B}\) [m] & \(d_{\mathcal{A}-B}\) & 30 \\ \hline Distance \(\mathcal{E}-\mathcal{B}\) [m] & \(d_{\mathcal{E}-B}\) & \(\geq\)60 \\ \hline Simulation time [s] & \(T_{\mathrm{S}in}\) & 2 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Notations, descriptions, and considered values. bi-variate histogram \(h\) by dividing the plane into \(N\times M\) linearly spaced tiles. Finally, we use the following rule to map each tile to the corresponding pixel value of the specific channel of the RGB image. * For values of \(h(i,j)\) such that \(0\leq h(i,j)\leq 255\), the corresponding channel's pixel values are \(p_{R}(i,j)=h(i,j)\), \(p_{G}(i,j)=0\), \(p_{B}(i,j)=0\). * When the range \((256\leq h(i,j)\leq 511)\), pixel values are set according to the following mapping: \(p_{R}(i,j)=255\), \(p_{G}(i,j)=h(i,j)-255\), \(p_{B}(i,j)=0\). * When \(h(i,j)>511\), the pixel values are \(p_{R}(i,j)=255\), \(p_{G}(i,j)=255\), \(p_{B}(i,j)=h(i,j)-510\). Table 3 summarizes our dataset configuration. We consider different configurations with the aim of obtaining balanced datasets of jammed and non-jammed samples that can be compared; i.e., all the configurations resort to 750 images. As discussed before, translating \(I-Q\) samples into images is an important step propaedeutical to the classification process. Therefore, we consider different image resolutions, as depicted in Table 3. In order to achieve uniform dataset sizes when applying different image resolutions, we considered a consistent number of samples, i.e., bit streams of different lengths. Finally, each dataset is composed of 1500 images (750 for \(X_{NJ}\) and \(X_{J}\) each). During the training process, we randomly split \(X_{NJ}\) into training set \(\mathcal{T}\) (60% \(\approx\) 450) and validation set \(\mathcal{V}\) (40% \(\approx\) 300). From \(X_{J}\), we only selected the 40% set of data to avoid the class imbalance problem for evaluation. **Multi-Class Classification. ** This methodology is considered when assuming Scenario 1 (jamming awareness); i.e., the model has previously been exposed to images generated from \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Image Resolution** & **No. of Samples** & **No Jamming [Images]** & **Jamming [Images]** \\ \hline \(224\times 224\times 3\) & 655,360 & 750 & 750 \\ \hline \(192\times 192\times 3\) & 471,040 & 750 & 750 \\ \hline \(156\times 156\times 3\) & 317,440 & 750 & 750 \\ \hline \(128\times 128\times 3\) & 204,800 & 750 & 750 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Dataset description: we consider various image sizes and a total of 750 images for both jammed and non-jammed signals while reporting the \(I-Q\) samples required to generate the images. Figure 7: Dataset generation process: \(I-Q\) samples are collected with and without the presence of the jammer.