# Step 13. Configuring a more accurate pathloss model¶

## Goals¶

By default, the medium uses the free-space path loss model, which assumes line-of-sight path, with no obstacles nearby to cause reflection or diffraction. Since our wireless hosts move on the ground, a more accurate path loss model would be the two-ray ground reflection model that calculates with one reflection from the ground.

## The model¶

It has been mentioned that ApskScalarRadioMedium relies on various subcomponents for computing path loss, obstacle loss, and background noise, among others. Installing the two-ray ground reflection model is just a matter of changing its pathLossType parameter from the default FreeSpacePathLoss to TwoRayGroundReflection. (Further options include RayleighFading, RicianFading, LogNormalShadowing and some others.)

The two-ray ground reflection model uses the altitudes of the transmitter and the receiver antennas above the ground as input. To compute the altitude, we need the hosts’ (x,y,z) positions, and the ground’s elevation at those points. The z coordinates of hosts have been set to 1.7m in an earlier step. The ground’s elevation is defined by the ground model. which is part of the physical environment model.

In this model, we’ll use FlatGround for ground model, and specify it to the physicalEnvironment module. (Note that we added physicalEnvironment to the network when we introduced obstacles.) The ground’s elevation is the elevation parameter of FlatGround. We set this parameter to 0m.

[Config Wireless13]
description = Configuring a more accurate pathloss model
extends = Wireless12

*.physicalEnvironment.ground.typename = "FlatGround"
*.physicalEnvironment.ground.elevation = 0m