# LoRaWAN Path Loss Measurements in an Urban Scenario Including Environmental Effects
## 5 Path Loss and Shadowing Modelling
### Log-Distance Combined Path Loss and Shadowing Model  
A standard method to fit a combined path loss and shadowing (CPLS) model by using empirical data is the LDPLM (Equation (6)),  
\[CPLS=K+10\cdot\gamma\cdot log_{10}(\frac{d}{d_{0}})+\psi, \tag{6}\]  
where \(K\) is a dimensionless constant that depends on the characteristics of the antennas and the average channel attenuation, \(d\) is the distance, \(d_{0}\) is the far-field distance, \(\gamma\) is the path loss exponent, and \(\psi\) is a random variable from a lognormal distribution, which characterizes shadowing, whose probability distribution function (PDF) is presented in Equation (7),  
\[p(\psi)=\frac{\xi}{\sqrt{2\pi}\cdot\sigma_{\psi}\cdot\psi}\cdot exp\left[- \frac{(10\cdot log_{10}(\psi)-\mu_{\psi})^{2}}{2\cdot\sigma_{\psi}^{2}}\right],\psi>0, \tag{7}\]  
where \(\xi=10/ln(10)\), \(\sigma_{\psi}\) is the standard deviation of \(\psi\), and \(\mu_{\psi}\) is the mean of \(\psi\). The CPLS has a LoS component attributed to the path loss and a stochastic component associated with the shadowing phenomenon, characterized by Equation (7). The LDPLM is assumed as a linear regression model where the input feature is the logarithm of the distance, \(K\) is the intercept, and \(\psi\) is the residual error, i.e., the difference between the actual measurements and the model's predictions. In that way, the LDPLM in Equation (6) can be fitted by using minimum squares optimization as expressed in Equation (8).  
Figure 11: Model fitting process. We (_i_) collected and cleaned the database, (_ii_) divided the dataset into training and testing, (_iii_) trained the models, and (_iv_) evaluated the models’ performances.  
Figure 12: Percentage of rows for training and testing subsets compared with the whole dataframe. The measurement campaigns started in October 2021 and finished on March 2022.  
\[\begin{split}\frac{\partial}{\partial\gamma}\sum_{j=1}^{n}\left[M_{i}(d _{i})-K-10\cdot\gamma\cdot log_{10}\left(\frac{d_{i}}{d_{0}}\right)\right]^{2} =0\\ \frac{\partial}{\partial K}\sum_{j=1}^{n}\left[M_{i}(d_{i})-K-10 \cdot\gamma\cdot log_{10}\left(\frac{d_{i}}{d_{0}}\right)\right]^{2}=0,\end{split} \tag{8}\]  
where \(M_{i}(d_{i})\) corresponds to the i\({}^{th}\) field measurement at the distance \(d_{i}\). The far-field distance \(d_{0}\) is calculated by  
\[d_{0}=\frac{2D^{2}}{\lambda} \tag{9}\]  
where \(D=25\,\mathrm{cm}\) is the largest antenna size, and \(\lambda=\frac{3\times 10^{8}}{9\times 10^{8}}=0.33\,\mathrm{m}\) is the wavelength, so \(d_{0}\geq 0.375\,\mathrm{m}\). In that way, we considered a far-field distance \(d_{0}=1\,\mathrm{m}\).  
After optimizing the model weights using our training subset, we found a path loss exponent \(\gamma=2.739\) and \(K=1.75\). This value agrees with the typical interval for urban microcells [12]. Then, we used the training and test sets as follows: (i) we computed the LDPLM values, and (ii) we obtained the RMSE, standard deviation \(s\), and the \(\mathrm{R}^{2}\) (Table 6). The RMSE can be interpreted as the ability of the model to forecast the PL component, the standard deviation \(s\) captures the ability of the model to preserve the same error when using a different training subset, and the \(\mathrm{R}^{2}\) can be associated with shadowing. It can be noticed that the RMSE for both subsets is similar for LDPLM, so that the fitted model can forecast the PL with an RMSE = 2.46 dB. In the same way, the \(\mathrm{R}^{2}\) for both subsets was 0.85, so the model can explain the shadowing variability by 85%.