Skip to main content
Ctrl+K
 - Home  - Home

Getting Started

  • Installing Comyx
  • Quickstart

Additional Resources

  • Examples
    • SISO Downlink NOMA
    • RIS Enhanced Communication
  • API Reference
    • comyx.network
    • comyx.fading
    • comyx.propagation
    • comyx.utils
    • comyx.stats
  • Research

Extras & Community

  • Contributing 💓
  • Releases
  • .rst

comyx.network.links

Contents

  • Module Summary
    • Classes
    • Functions
  • Reference
    • Link
      • Link.tx
      • Link.rx
      • Link.shape
      • Link.channel_gain
      • Link.distance
      • Link.magnitude
      • Link.pathloss
      • Link.phase
      • Link.generate_rvs()
      • Link.rician_fading()
      • Link.update_channel()
      • Link.update_params()
    • cascaded_channel_gain()
    • effective_channel_gain()

comyx.network.links#

Module Summary#

Classes#

Link

Represents a link in the modelled environment.

Functions#

cascaded_channel_gain(→ NDArrayComplex)

Calculate the cascaded channel gain.

effective_channel_gain(→ NDArrayComplex)

Calculate the effective channel gain.

Reference#

class comyx.network.links.Link(tx: Transceiver | RIS, rx: Transceiver | RIS, fading_args: dict[str, Any], pathloss_args: dict[str, Any], shape: Tuple[int, Ellipsis], rician_args: dict[str, Any] | None = None, custom_rvs: NDArrayComplex | None = None, distance: float | None = None, seed: int | None = None)[source]#

Represents a link in the modelled environment.

A link is a connection between two transceivers. It is characterized by the distance between the two transceivers, the path loss, and the channel gain.

If rician_args are provided, the fading_args are used for the NLOS component and the rician_args are used for the LOS component.

Mathematically, the channel gain is given by

\[h_{t,r} = g_{t,r} \sqrt{PL(d_{t,r})},\]

where \(g_{t,r}\) is the small-scale fading (sampled from a distribution), \(PL(d_{t,r})\) is the path loss, and \(d_{t,r}\) is the distance between the transceivers.

tx#

Transmitter of the link.

rx#

Receiver of the link.

shape#

Number of shape for the channel gain.

property channel_gain: NDArrayComplex#

Channel gain between the transceivers.

property distance: float#

Distance between the transceivers.

property magnitude: NDArrayFloat#

Magnitude of the channel

property pathloss: NDArrayFloat#

Path loss between the transceivers.

property phase: NDArrayFloat#

Phase of the channel

generate_rvs(custom_rvs: NDArrayComplex | None = None, seed: int = None) → None[source]#

Generate random variables for the channel gain.

Not private to allow for the generation of new channel gains for more flexible simulations.

rician_fading(K: float, order: str = 'post', ris: bool = True) → NDArrayComplex[source]#

Generate Rician fading channel gain between the transceivers.

Parameters:
  • K – Rician K-factor.

  • pos_a – Position of the first transceiver.

  • pos_b – Position of the second transceiver.

  • order – Order of RIS in the link. Possible values are ‘post’ and ‘pre’.

  • ris – Whether to consider the RIS in the link.

Returns:

Rician fading channel gain.

update_channel(distance: float | None = None, custom_rvs: NDArrayComplex | None = None, ex_pathloss: bool = False, ex_rvs: bool = False, seed: int | None = None) → None[source]#

Update the channel gain.

Parameters:
  • distance – New distance between the transceivers.

  • custom_rvs – New random variables for the channel gain.

  • ex_pathloss – Whether to exclude distance-based params from the update.

  • ex_rvs – Whether to exclude the random variables from the update.

  • seed – Seed for the random number generator.

update_params(distance: float | None = None) → None[source]#

Update the parameters of the link.

Parameters:

distance – New distance between the transceivers.

comyx.network.links.cascaded_channel_gain(tR_link: Link, Rr_link: Link, style: str = 'sum', ele_idx: int = 0) → NDArrayComplex[source]#

Calculate the cascaded channel gain.

The cascaded channel gain is the channel gain between the transmitter and the receiver through the RIS. Mathematically, the cascaded channel gain through the RIS is given by

\[h_{csc}= \mathbf{h}_{R,r}^T \mathbf{R} \mathbf{h}_{t,R},\]

where \(\mathbf{h}_{t,R}\) is the channel gain between the transmitter and the RIS, \(\mathbf{h}_{R,r}\) is the channel gain between the RIS and the receiver, and \(\mathbf{R}\) is the reflection matrix of the RIS. The superscript \(T\) denotes the transpose operator.

If channel_gain_tR is of shape (Nt, K, Mc), and channel_gain_Rr is of shape (K, Nr, Mc), where Nt is the number of transmit antennas, K is the number of RIS elements, Nr is the number of receive antennas, and Mc is the number of channel realizations, then the cascaded channel gain is of shape (Nt, Nr, Mc). For SISO links, the cascaded channel gain is of shape (1, 1, Mc).

Parameters:
  • tR_link – Link between the transmitter and the RIS.

  • Rr_link – Link between the RIS and the receiver.

  • style – Formula used to calculate the cascaded channel gain. Possible values are ‘sum’ and ‘matrix’.

  • ele_idx – Index of the elements of RIS in channel gain matrix.

Returns:

Cascaded channel gain.

comyx.network.links.effective_channel_gain(tr_link: Link, tR_link: Link, Rr_link: Link, style: str = 'sum', ele_idx: int = 0) → NDArrayComplex[source]#

Calculate the effective channel gain.

The effective channel gain is the channel gain between the transceiver and the receiver through the RIS. Mathematically, the effective channel gain through the RIS is given by

\[h_{eff}= h_{t,r} + \mathbf{h}_{R,r}^T \mathbf{R} \mathbf{h}_{t,R},\]

where \(\mathbf{h}_{t,R}\) is the channel gain between the transmitter and the RIS, \(\mathbf{h}_{R,r}\) is the channel gain between the RIS and the receiver, \(\mathbf{R}\) is the reflection matrix of the RIS, and \(h_{t,r}\) is the channel gain between the transmitter and the receiver. The superscript \(T\) denotes the transpose operator.

Parameters:
  • tr – Direct link.

  • tR – Link between the transmitter and the RIS.

  • Rr – Link between the RIS and the receiver.

  • style – Formula used to calculate the cascaded channel gain. Possible values are ‘sum’ and ‘matrix’.

  • ele_idx – Index of the elements of RIS in channel gain matrix.

Returns:

Effective channel gain.

Contents
  • Module Summary
    • Classes
    • Functions
  • Reference
    • Link
      • Link.tx
      • Link.rx
      • Link.shape
      • Link.channel_gain
      • Link.distance
      • Link.magnitude
      • Link.pathloss
      • Link.phase
      • Link.generate_rvs()
      • Link.rician_fading()
      • Link.update_channel()
      • Link.update_params()
    • cascaded_channel_gain()
    • effective_channel_gain()

By Muhammad Umer

© Copyright 2024, Muhammad Umer.