# Step 13. Configuring a more accurate path loss model¶

## Goals¶

By default, the medium uses the free-space path loss model, which assumes a 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 the 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



## Results¶

The image below shows the bit error rate of host R1’s radio as a function of time. The bit error rate is shown when free space path loss is used, and when using the two-ray ground reflection model. The interval shown here corresponds to the time in the simulation when host R1 is not cut off from host A by the wall anymore, and also still in communication range of host A and B. In the interval that is shown, from around 5 seconds to 11 seconds, the distance between host R1 and hosts A and B is increasing, which results in an increase in the bit error rate as well. There is no significant difference between the free space propagation path loss and the two-ray ground reflection path loss at first. The two curves separate towards the end of the displayed interval. As expected, in the case of the two-ray ground reflection model, the bit error rate is greater.

Number of packets received by host B: 679

## Discussion¶

Use this page in the GitHub issue tracker for commenting on this tutorial.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8509323000907898, "perplexity": 998.6987685680438}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-40/segments/1600400191780.21/warc/CC-MAIN-20200919110805-20200919140805-00269.warc.gz"}