# Detecting Jamming in Smart Grid Communications via Deep Learning
## 5 Theoretical Framework and Methodology
### Theoretical Framework  
As previously described regarding the two scenarios in Section 3, this section develops the theoretical framework for our reference scenario model. We consider a standard BB-PLC network deployed in a residential environment, as illustrated in Figure 5.  
The network comprises various devices engaged in communication through the power-line medium. Our work focuses on the detection of denial of service attacks (jamming) to the communication between \(\mathcal{A}\) and \(\mathcal{B}\) by a malicious entity (\(\mathcal{E}\)). In the reference scenario, the adversary (\(\mathcal{E}\)) strategically uses a jamming attack, injecting a disruptive signal into the PLC network with the explicit goal of disrupting the communication between \(\mathcal{A}\) and \(\mathcal{B}\). Within the framework of the PLC channel model (depicted in Figure 6), the parameters \(h_{\mathcal{A}-\mathcal{B}}\) and \(h_{\mathcal{E}-\mathcal{B}}\) model the intricate channel gains characterizing the \(\mathcal{A}-\mathcal{B}\) and \(\mathcal{E}-\mathcal{B}\) links, respectively. The inclusion of Additive White Gaussian Noise (AWGN), denoted as \(n_{\mathcal{B}}\), further underscores the complexities inherent in the communication channels under consideration. This comprehensive analysis improves our understanding of the disruptive mechanisms orchestrated by the adversary within the PLC network. Consequently, we can model the instantaneous Signal-to-Noise Ratio (SNR) at \(\mathcal{B}\) as per Equation (5). Figure 5: Broadband in-home PLC system considered in our paper. \(\mathcal{A}\) and \(\mathcal{B}\) exchange messages over the PLC network in the presence of a PLC jammer device (\(\mathcal{E}\)). \[\gamma_{A-B}=\frac{P_{T}\,H_{A-B}}{P_{j}\,H_{\varepsilon_{-}B}+N_{B}}, \tag{5}\]  
where \(P_{T}\) represents the transmit signal power, \(P_{l}\) denotes the jamming signal power, \(H_{X-B}\) is the squared magnitude of the complex channel gain \(h_{X-B}\) (where \(X\in\{\mathcal{A},\mathcal{E}\}\)), and \(N_{B}\) is the corresponding noise power. We model the PLC channels as Rayleigh-fading channels, in line with the existing literature [58; 59; 60], with the Probability Density Function (PDF) expressed as follows  
\[f_{h_{X-B}}(x)=\frac{1}{\widehat{H}_{X-B}(F_{C},d_{X-B})}\exp\left(\frac{-x}{ \widehat{H}_{X-B}(F_{C},d_{X-B})}\right), \tag{6}\]  
where \(\widehat{H}_{X-B}(F_{C},d_{X-B})\) denotes the mean of \(H_{X-B}\), representing the average frequency-distance-dependent PLC channel attenuation. \(F_{C}\) is the carrier frequency, and \(d_{X-B}\) is the distance associated with the \(X-B\) link. According to [60], \(\widehat{H}_{X-B}(F_{C},d_{X-B})\) is expressed as per Equation (7). \[\widehat{H}_{X-B}(F_{C},d_{X-B})=\exp\Big{(}-2\left[a_{0}+a_{1}\,F_{C}^{a_{2}} \right]d_{X-B}\Big{)}, \tag{7}\]  
Here, \(a_{0}\), \(a_{1}\), and \(a_{2}\) denote PLC signal attenuation parameters pertinent to the PLC environment. Table 2 provides a comprehensive overview of the primary notation utilized in this manuscript, along with the corresponding parameter values used later for evaluation purposes. The PLC system employs Orthogonal Frequency Division Multiplexing (OFDM) with \(N_{SC}\) sub-carriers per OFDM symbol. The Fast Fourier Transform (FFT) of size \(N_{FFT}\) is used for OFDM modulation and demodulation, with sub-carrier spacing \(\Delta_{f}\) between adjacent frequencies. Each frame consists of \(N_{symb}^{Fm}\) OFDM symbols, and, for our total simulation time \(T_{sim}\), we use \(N_{resme}\) frames, resulting in a total of \(N_{symb}\) OFDM symbols transmitted during the experiment. In the remainder of this section, we will discuss the main tasks performed by the receiver to identify the presence of a jammer in the network; recall Figure 1. A preliminary phase in our methodology involves generating images from the collected \(I-Q\) samples.