How to Calculate Network Carrier Interference Ratio in NS2

To calculate the Network Carrier-to-Interference Ratio (CIR) in NS2 this is an important parameter in wireless communication that computes the ratio of the power of the desired signal (the carrier) to the power of intrusive signals. It supports state the quality of a wireless link in the presence of intervention. A higher CIR means that the wanted signal is stronger compared to the interference, leading to better communication performance.

Since the ns2 lacks the built-in technology for estimating the Carrier-toInterference Ratio (CIR), you have to calculate it manually by evaluating the power of the carrier signal and the power of interfering signals. We provide the essential steps to measure the Carrier-to-Interference Ratio (CIR) using ns2 in the following below:

CIR Formula

The Carrier-to-Interference Ratio (CIR) can be estimated as:

CIR (linear)=PcarrierPinterference\text{CIR (linear)} = \frac{P_{\text{carrier}}}{P_{\text{interference}}}CIR (linear)=Pinterference​Pcarrier​​ CIR (dB)=10×log⁡10(PcarrierPinterference)\text{CIR (dB)} = 10 \times \log_{10} \left( \frac{P_{\text{carrier}}}{P_{\text{interference}}} \right)CIR (dB)=10×log10​(Pinterference​Pcarrier​​)

Where:

  • PcarrierP_{\text{carrier}}Pcarrier​ is the power of the preferred carrier signal.
  • PinterferenceP_{\text{interference}}Pinterference​ is the total power of meddling signals.

Steps to Calculate CIR in NS2

  1. Set Up the Wireless Network in NS2

First, you need to configure a wireless network with nodes transferring over a common channel. In this scenario, one node transmits the carrier signal, while other nodes may transmit intrusive signals.

Example Setup:

# Create a new simulator object

set ns [new Simulator]

# Define the wireless network settings

set val(chan)           Channel/WirelessChannel  ;# Wireless channel

set val(prop)           Propagation/TwoRayGround ;# Propagation model

set val(netif)          Phy/WirelessPhy          ;# PHY Layer

set val(mac)            Mac/802_11               ;# MAC Layer

set val(ifq)            Queue/DropTail/PriQueue  ;# Queue

set val(ll)             LL                       ;# Link Layer

set val(ant)            Antenna/OmniAntenna      ;# Omni-directional antenna

# Create nodes for the carrier signal and interference

set carrierNode [$ns node]    ;# Node for carrier signal

set interfererNode1 [$ns node] ;# Node for interferer 1

set interfererNode2 [$ns node] ;# Node for interferer 2

# Configure wireless links for nodes (with transmission power, range, etc.)

$ns at 1.0 “$carrierNode setdest 250 250 10”

$ns at 2.0 “$interfererNode1 setdest 250 250 5”

$ns at 3.0 “$interfererNode2 setdest 250 250 5”

This script defines a wireless network where one node transmits the carrier signal and other nodes behave like sources of interference.

  1. Set Transmission Power and Interference Sources

Estimate the CIR by stating the transmission power for the carrier node and the intervention nodes.

Example Configuration for Transmission Power:

# Set transmission power for the carrier signal and interferers

$carrierNode set Pt_ 0.2818  ;# Transmission power of carrier node in Watts

$interfererNode1 set Pt_ 0.1  ;# Transmission power of interferer 1 in Watts

$interfererNode2 set Pt_ 0.15 ;# Transmission power of interferer 2 in Watts

Here, the carrier node has a transmission power of 0.2818 W, and the interferer nodes have lower transmission powers of 0.1 W and 0.15 W.

  1. Calculate the Received Power for Carrier and Interference Signals

The received power at the receiver from both the carrier signal and interfering signals in terms of the transmission power, distance, and path loss model. You can use the Friis Free Space Path Loss model or another propagation model (e.g., Two-Ray Ground) to measure the received power.

Formula for Received Power:

Preceived=Ptransmitted×Gt×Gr×(λ4πd)2P_{\text{received}} = P_{\text{transmitted}} \times G_t \times G_r \times \left( \frac{\lambda}{4 \pi d} \right)^2Preceived​=Ptransmitted​×Gt​×Gr​×(4πdλ​)2

Where:

  • PtransmittedP_{\text{transmitted}}Ptransmitted​ is the transmission power.
  • GtG_tGt​ and GrG_rGr​ are the transmitter and receiver antenna gains.
  • λ\lambdaλ is the signal wavelength.
  • ddd is the distance amongst the transmitter and receiver.

TCL Script to Calculate Received Power:

# Function to calculate received power based on transmission power, distance, and frequency

proc calculate_received_power {tx_power distance frequency} {

set c 3.0e8   ;# Speed of light in m/s

set lambda [expr $c / $frequency]  ;# Wavelength in meters

set Gt 1.0    ;# Transmitter antenna gain

set Gr 1.0    ;# Receiver antenna gain

# Calculate path loss (Free Space Path Loss)

set path_loss_factor [expr ($lambda / (4 * 3.1416 * $distance)) ** 2]

# Calculate received power

set received_power [expr $tx_power * $Gt * $Gr * $path_loss_factor]

return $received_power

}

# Example usage: Carrier node and interferers

set carrier_tx_power 0.2818   ;# Transmission power of carrier in Watts

set interferer1_tx_power 0.1  ;# Transmission power of interferer 1 in Watts

set interferer2_tx_power 0.15 ;# Transmission power of interferer 2 in Watts

set distance_carrier 100      ;# Distance between carrier node and receiver (in meters)

set distance_interferer1 150  ;# Distance between interferer 1 and receiver

set distance_interferer2 200  ;# Distance between interferer 2 and receiver

set frequency 2.4e9           ;# Frequency in Hz (2.4 GHz for Wi-Fi)

# Calculate received powers

set received_power_carrier [calculate_received_power $carrier_tx_power $distance_carrier $frequency]

set received_power_interferer1 [calculate_received_power $interferer1_tx_power $distance_interferer1 $frequency]

set received_power_interferer2 [calculate_received_power $interferer2_tx_power $distance_interferer2 $frequency]

puts “Received power from carrier: $received_power_carrier W”

puts “Received power from interferer 1: $received_power_interferer1 W”

puts “Received power from interferer 2: $received_power_interferer2 W”

This script estimates the received power for both the carrier node and interfering nodes according to their transmission power and distance from the receiver.

  1. Calculate the Carrier-to-Interference Ratio (CIR)

Once you have the received power for the carrier and the interfering signals, you can measure the CIR.

TCL Script to Calculate CIR:

# Function to calculate CIR

proc calculate_cir {carrier_power interference_power1 interference_power2} {

# Total interference power is the sum of all interfering signals

set total_interference [expr $interference_power1 + $interference_power2]

# Calculate CIR (linear)

set cir_linear [expr $carrier_power / $total_interference]

# Convert CIR to dB

set cir_dB [expr 10 * log10($cir_linear)]

return $cir_dB

}

# Calculate CIR

set cir_dB [calculate_cir $received_power_carrier $received_power_interferer1 $received_power_interferer2]

puts “Calculated CIR: $cir_dB dB”

This script calculates the CIR in dB based on the received power of the carrier and the total received power from the interfering signals.

  1. Log CIR Values During the Simulation

If you want to observe the CIR dynamically during the simulation, you can log the CIR values at regular intervals.

TCL Script to Log CIR:

# Function to log CIR at regular intervals

proc log_cir {carrier_power interference_power1 interference_power2} {

global ns

set cir_dB [calculate_cir $carrier_power $interference_power1 $interference_power2]

puts “Time: [$ns now], CIR: $cir_dB dB”

# Re-schedule this procedure to run after 1 second

$ns at [expr [$ns now] + 1.0] “log_cir $carrier_power $interference_power1 $interference_power2”

}

# Start logging CIR at 1 second intervals

$ns at 1.0 “log_cir $received_power_carrier $received_power_interferer1 $received_power_interferer2”

This will log the CIR values at 1-second intervals during the simulation, permitting you to track how CIR vary dynamically.

In this computation, we successfully learned to measure the Carrier-to-Interference Ratio (CIR) in the ns2 and make sure to consider the delivered techniques before computing. If needed, we will offer additional details about it.

Discover the most innovative project ideas and topics that our team is passionately developing to enhance communication performance. If you’re looking to calculate the Network Carrier Interference Ratio using the NS2 tool, we are here to assist you in achieving outstanding results. Reach out to ns2project.com for exceptional outcomes.