# Detecting Jamming in Smart Grid Communications via Deep Learning
## 6 Performance Evaluation
### Link Quality  
Several metrics have been proposed to measure the reliability of data delivery, such as the BER, packet loss rate, latency, and jitter. In the remainder of this paper, we rely on the BER to measure the impact of the jamming signal on the receiver. We computed the BER by counting the number of corrupted bits at the receiver side with respect to the total transmitted ones. Figure 12 shows the BER as a function of the distance between the jammer and the receiver (x-axis) when varying \(\text{RJP}\in\{0.1,0.35,0.6,0.85,1\}\) (different curves in Figure 12), i.e., the ratio of the power used for jamming with respect to the power of the transmitter. We consider a scenario where the transmitter and the receiver are 30 m away, and the distance between the jammer and the receiver is a parameter of the system specified in the x-axis of Figure 12. In this regard, as shown in Figure 12, we notice that  
\begin{table}
\begin{tabular}{l c c} \hline \hline
**Hyperparameter** & **Search Range** & **Optimal Configuration** \\ \hline Hidden Layer Size & [4, 16, 32] & 32 \\ Encoder Transfer Function & [logsig, satlin] & logsig \\ Decoder Transfer Function & [logsig, satlin, purelin] & satlin \\ Sparsity Proportion & [0.1, 0.5, 1.0] & 0.1 \\ Sparsity Regularization & [1, 5, 10] & 10.0 \\ \(L_{2}\) Weight Regularization & \{0.001, 0.01, 0.1, 0.5, 1.0\} & 0.1 \\ Training Epochs & 50 & 50 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Hyperparameter search spaces and selected optimal configurations.  
the BER of the link is always quite low, and, for distances higher than 40 m, it is always zero. Thus, detecting jamming at such a distance through the analysis of the BER is simply ineffective. When the adversary moves away from the receiver, the BER drops. It should be noted that, when the jammer is at the same distance from the transmitter, i.e., 30 m, the BER cannot be greater than 15%, assuming the worst case of a jammer that equals the transmission power of the transmitter (RJP = 1). Another important result from Figure 12 is the distance according to which the BER \(\approx\) 0 independently of the RJP. In fact, we observe that, when the distance between the jammer and the receiver is greater than 50 m, BER \(\approx\) 0, recalling that the distance between the transmitter and the receiver is 30 m.  
To detect the presence of noise, whether artificial or malicious, SNR has been commonly used in prior studies to assess link quality [64; 65]. The probability density function of SNR is shown in Figure 13, and it is computed using Equation (9), where \(P_{rx}\) represents the received signal power and \(N\) denotes the noise power.  
\[SNR|_{dB}=P_{rx}|_{dB}-N|_{dB}, \tag{9}\]  
\[N|_{dB}=30+10\log_{10}E[(\sqrt{I^{2}+Q^{2}}-\mu)^{2}], \tag{10}\]  
\[P_{rx}|_{dB}=30+10\log_{10}(I^{2}+Q^{2}), \tag{11}\]  
Here, \(E[(\sqrt{I^{2}+Q^{2}}-\mu)^{2}]\) is computed over a sliding window of 10 IQ samples, and \(\mu\) is the mean of the magnitude over that window. In Figure 13, the transmitter (\(\mathcal{A}\)) and receiver (\(\mathcal{B}\)) are separated by 30 m, while the jammer (\(\mathcal{E}\)) is placed at varying distances from the receiver, specifically at {30, 40, 50, 60, 65, 70, and 75} m with a fixed RJP of 1.0. The figure shows that, as \(\mathcal{E}\) moves away from \(\mathcal{B}\), the SNR increases, indicating reduced noise dominance. This results in a more challenging scenario for distinguishing jammed from non-jammed signals based purely on SNR analysis.