# Two-Slope Path Loss

*A two-slope path loss model.*

`obj/path_loss/path_loss_two_slope.m`

Superclass: Path Loss

#### On This Page

- About
- Creating a Free-Space Path Loss Object
- Key Properties
- Setting the Path Loss Exponents
- Setting the Reference Distance
- Setting the Reference Path Loss
- Example Setup
- Getting the Attenuation
- List of Properties
- List of Methods
- Methods Documentation

### About

The `path_loss_two_slope`

object represents a two-slope path loss model.

The path loss under a two-slope path loss model can be described entirely by five parameters:

- the distance of the path
- the reference distance
- the path loss at the reference distance
- the path loss exponent within the reference distance
- the path loss exponent beyond the reference distance

The path loss (or attenuation) stemming from a free-space path loss model can be deterministically written as

where is the path * gain* and is the path

*.*

**loss**The `path_loss_two_slope`

object is a subclass of the `path_loss`

object.

### Creating a Two-Slope Path Loss Object

A two-slope path loss object `path_loss_two_slope`

can be created via

```
p = path_loss.create('two-slope')
```

### Key Properties

The `path_loss_two_slope`

object inherits all properties of the `path_loss`

object, the key ones being

```
p.attenuation
p.carrier_frequency
p.carrier_wavelength
p.propagation_velocity
p.distance
```

In addition to these, the `path_loss_two_slope`

object also has the property

```
p.path_loss_exponents
```

to capture the path loss exponents and and

```
p.reference_distance
p.reference_path_loss
```

to capture the reference distance and reference path loss , respectively.

### Setting the Path Loss Exponents

To set the path loss exponents of a two-slope path loss object `p`

, use

```
p.set_path_loss_exponents(ple_1,ple_2)
```

where `ple_1`

and `ple_2`

are the path loss exponents and .

### Example Setup

A typical `path_loss_two_slope`

object setup looks something similar to

```
p = path_loss.create('two-slope')
p.set_carrier_frequency(fc)
p.set_propagation_velocity(vel)
p.set_distance(d)
p.set_path_loss_exponents(ple_1,ple_2)
p.set_reference_distance(d0)
p.set_reference_path_loss(L0,'dB')
```

### Invoking a Realization

To realize the path loss, use

```
atten = p.realization()
```

which, when appropriately setup, will return the attenuation `atten`

for the given carrier wavelength, distance, and path loss exponent.

Note that `atten`

is related to the large-scale gain by simply `atten`

.

### Getting the Attenuation

To get the realized attenuation of a `path_loss_free_space`

object `p`

, one can also use

```
atten = p.get_attenuation()
```

where `atten`

is the attenuation of the path loss (power loss, linear scale).

### List of Properties

The `path_loss_two_slope`

object contains the following properties:

`path_loss_two_slope.reference_distance`

`path_loss_two_slope.reference_path_loss`

`path_loss_two_slope.path_loss_exponents`

`path_loss_two_slope.name`

`path_loss_two_slope.type`

`path_loss_two_slope.distance`

`path_loss_two_slope.attenuation`

`path_loss_two_slope.carrier_frequency`

`path_loss_two_slope.carrier_wavelength`

`path_loss_two_slope.propagation_velocity`

### List of Methods

The `path_loss_two_slope`

object contains the following methods:

`path_loss_two_slope.compute_path_loss_attenuation`

Computes the path attenuation (path loss) according to the free-space path loss (FSPL) formula.`path_loss_two_slope.create`

Creates a path loss object of a specific type.`path_loss_two_slope.get_attenuation`

Returns the realized attenuation of the path loss model.`path_loss_two_slope.initialize`

Initializes a path loss object.`path_loss_two_slope.initialize_free_space`

Initializes a two-slope path loss object.`path_loss_two_slope.path_loss_two_slope`

Creates a two-slope path loss object.`path_loss_two_slope.realization`

Invokes a realization of the path loss.`path_loss_two_slope.set_carrier_frequency`

Sets the carrier frequency of the channel. Also updates the carrier wavelength accordingly.`path_loss_two_slope.set_distance`

Sets the distance of the path (in meters).`path_loss_two_slope.set_name`

Sets the name of the path loss model.`path_loss_two_slope.set_path_loss_attenuation`

Sets the attenuation of the path loss model.`path_loss_two_slope.set_path_loss_exponents`

Sets the two path loss exponents.`path_loss_two_slope.set_propagation_velocity`

Sets the propagation velocity of the channel. Also updates the carrier wavelength accordingly.`path_loss_two_slope.set_reference_distance`

Sets the reference distance.`path_loss_two_slope.set_reference_path_loss`

Sets the reference path loss.`path_loss_two_slope.set_type`

Sets the type of path loss model.

### Methods Documentation

`compute_path_loss_attenuation(d)`

`compute_path_loss_attenuation(d)`

Computes the path attenuation (path loss) according to the free-space path loss (FSPL) formula.

- Usage:
`atten = compute_path_loss_attenuation()`

`atten = compute_path_loss_attenuation(d)`

*Input Arguments*:`d`

— (optional) distance(s) in meters to evaluate the path loss at; if not passed, the path loss object’s distance property will be used*Return Values*:`atten`

— the path attenuation (path loss) (a power loss)*Notes*:- The path loss equation used is

`create(type)`

`create(type)`

Creates a path loss object of a specific type.

- Usage:
`obj = path_loss.create()`

`obj = path_loss.create(type)`

*Input Arguments*:`type`

— (optional) a string specifying which path loss model to create*Return Values*:`obj`

— a path loss object

`get_attenuation()`

`get_attenuation()`

Returns the realized attenuation of the path loss model.

- Usage:
`val = get_attenuation()`

*Return Values*:`val`

— the attenuation (power loss) of the path

`initialize()`

`initialize()`

Initializes a path loss object.

- Usage:
`initialize()`

`initialize_free_space()`

`initialize_free_space()`

Initializes a two-slope path loss object.

- Usage:
`INITIALIZE_TWO_SLOPE()`

`path_loss_two_slope(name)`

`path_loss_two_slope(name)`

Creates a two-slope path loss object.

- Usage:
`obj = path_loss_two_slope()`

`obj = path_loss_two_slope(name)`

*Input Arguments*:`name`

— an optional name for the object*Return Values*:`obj`

— an object representing two-slope path loss

`realization()`

`realization()`

Invokes a realization of the path loss.

- Usage:
`atten = realization()`

*Return Values*:`atten`

— the realized path loss attenuation*Notes*:- Since no random variables are involved in the FSPL equation, it will be determininstic and thus fixed across realizations.

`set_carrier_frequency(fc)`

`set_carrier_frequency(fc)`

Sets the carrier frequency of the channel. Also updates the carrier wavelength accordingly.

- Usage:
`set_carrier_frequency(fc)`

*Input Arguments*:`fc`

— carrier frequency (Hz)*Notes*:- Also updates carrier wavelength.

`set_distance(d)`

`set_distance(d)`

Sets the distance of the path (in meters).

- Usage:
`set_distance(d) Sets the distance of the link to a specific`

`value.`

*Input Arguments*:`d`

— distance of the path (in meters)

`set_name(name)`

`set_name(name)`

Sets the name of the path loss model.

- Usage:
`set_name()`

`set_name(name)`

*Input Arguments*:`name`

— (optional) a string; if not passed, ‘path-loss’ is the default name used

`set_path_loss_attenuation(atten)`

`set_path_loss_attenuation(atten)`

Sets the attenuation of the path loss model.

- Usage:
`set_path_loss_attenuation(atten)`

*Input Arguments*:`atten`

— the attenuation (power loss) of the path

`set_path_loss_exponents(ple_1,ple_2)`

`set_path_loss_exponents(ple_1,ple_2)`

Sets the two path loss exponents.

- Usage:
`set_path_loss_exponents(ple_1,ple_2)`

*Input Arguments*:`ple_1`

— path loss exponent for distances within the reference distance`ple_2`

— path loss exponent for distances beyond the reference distance

`set_propagation_velocity(val)`

`set_propagation_velocity(val)`

Sets the propagation velocity of the channel. Also updates the carrier wavelength accordingly.

- Usage:
`set_propagation_velocity(val)`

*Input Arguments*:`val`

— propagation velocity (meters/sec)

`set_reference_distance(d0)`

`set_reference_distance(d0)`

Sets the reference distance.

- Usage:
`set_reference_distance(d0)`

*Input Arguments*:`d0`

— the reference distance at which the path loss exponent changes from one path loss exponent to another

`set_reference_path_loss(L0,unit)`

`set_reference_path_loss(L0,unit)`

Sets the reference path loss.

- Usage:
`set_reference_path_loss(d0)`

`set_reference_path_loss(d0,unit)`

*Input Arguments*:`L0`

— the path loss (linear power loss) measured at the reference distance`unit`

— (optional) a string specifying the unit of L0

`set_type(type)`

`set_type(type)`

Sets the type of path loss model.

- Usage:
`set_type()`

`set_type(type)`

*Input Arguments*:`type`

— (optional) a string; if not passed, ‘default’ is the default type used