How to Implement Network Data Fusion in NS2

To implement the Network Data Fusion within NS2 that has encompasses to combining data from several sources (nodes) to make a more correct or useful dataset. It is particularly used in Wireless Sensor Networks (WSNs) in which numerous sensors are gather the various kind of data and also data fusion procedure combines the data to create the finest decisions, enhance bandwidth usage, minimizes the data redundancy, or develop reliability.

This fusion can happen at various layers of the network such as application, transport, or network layers. In this NS2, we can execute the network data fusion by replicating how data gathered by various nodes is processed and combined at a central node or a fusion center. We provide stepwise protocol on how to perform the network data fusion in this network simulator NS2:

Key Aspects of Network Data Fusion:

  1. Sensor Nodes: Several nodes (sensors) are gathered data and forward it to a central node (fusion center).
  2. Fusion Center: The node responsible for gathering and merging the data from various sensor nodes.
  3. Data Aggregation: The procedure in which data from various nodes is combined, filtered, or processed to minimize the redundancy and enhance the accuracy.

Steps to Implement Network Data Fusion in NS2

  1. Set up Sensor Nodes: State numerous sensor nodes which gather as well as forward the data to a fusion center.
  2. Implement Data Fusion: Describe a process at the fusion center to combine the data from several sensor nodes.
  3. Send Fused Data: Send the fused data to another end like a base station if optional.

Example: Simulating Network Data Fusion in NS2

Here’s instance that establishes how to configure several sensor nodes which send data to a fusion center. It aggregates the data and outcomes the fused result.

Step 1: Set Up Sensor Nodes and Fusion Center

# Define the simulator object

set ns [new Simulator]

# Define trace and nam files for output

set tracefile [open out.tr w]

set namfile [open out.nam w]

$ns trace-all $tracefile

$ns namtrace-all $namfile

# Define a ‘finish’ procedure to end the simulation and visualize in NAM

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam out.nam &

exit 0

}

# Set up the topography for the simulation area

set topo [new Topography]

$topo load_flatgrid 1000 1000

# Define the wireless channel

set chan [new Channel/WirelessChannel]

# Configure wireless nodes (sensor nodes and fusion center)

$ns node-config -adhocRouting DSDV \

-llType LL \

-macType Mac/802_11 \

-ifqType Queue/DropTail/PriQueue \

-ifqLen 50 \

-antType Antenna/OmniAntenna \

-propType Propagation/TwoRayGround \

-phyType Phy/WirelessPhy \

-channel $chan

# Create sensor nodes (sensor1, sensor2, sensor3)

set sensor1 [$ns node]

set sensor2 [$ns node]

set sensor3 [$ns node]

# Create the fusion center node (fusion_center)

set fusion_center [$ns node]

# Set node positions (for visualization in NAM)

$sensor1 set X_ 100; $sensor1 set Y_ 100; $sensor1 set Z_ 0

$sensor2 set X_ 300; $sensor2 set Y_ 100; $sensor2 set Z_ 0

$sensor3 set X_ 500; $sensor3 set Y_ 100; $sensor3 set Z_ 0

$fusion_center set X_ 300; $fusion_center set Y_ 300; $fusion_center set Z_ 0

# Create duplex wireless links between the sensor nodes and the fusion center

$ns duplex-link $sensor1 $fusion_center 2Mb 10ms DropTail

$ns duplex-link $sensor2 $fusion_center 2Mb 10ms DropTail

$ns duplex-link $sensor3 $fusion_center 2Mb 10ms DropTail

# Define TCP traffic from each sensor node to the fusion center

# Sensor 1 traffic

set tcp1 [new Agent/TCP]

set sink1 [new Agent/TCPSink]

$ns attach-agent $sensor1 $tcp1

$ns attach-agent $fusion_center $sink1

$ns connect $tcp1 $sink1

set ftp1 [new Application/FTP]

$ftp1 attach-agent $tcp1

$ftp1 start 1.0  ;# Start sending data at 1 second

# Sensor 2 traffic

set tcp2 [new Agent/TCP]

set sink2 [new Agent/TCPSink]

$ns attach-agent $sensor2 $tcp2

$ns attach-agent $fusion_center $sink2

$ns connect $tcp2 $sink2

set ftp2 [new Application/FTP]

$ftp2 attach-agent $tcp2

$ftp2 start 1.2  ;# Start sending data at 1.2 seconds

# Sensor 3 traffic

set tcp3 [new Agent/TCP]

set sink3 [new Agent/TCPSink]

$ns attach-agent $sensor3 $tcp3

$ns attach-agent $fusion_center $sink3

$ns connect $tcp3 $sink3

set ftp3 [new Application/FTP]

$ftp3 attach-agent $tcp3

$ftp3 start 1.4  ;# Start sending data at 1.4 seconds

# Step 2: Simulate Data Fusion at the Fusion Center

# Data fusion procedure that combines the data from all sensor nodes

proc data_fusion {} {

puts “Fusion Center: Combining data from all sensors…”

# Simulate the fusion process by combining data (this is a simple printout for demo purposes)

set fused_data [expr rand()*100]

puts “Fusion Center: Fused data value: $fused_data”

}

# Schedule data fusion after all data is received (around 2.0 seconds)

$ns at 2.0 “data_fusion”

# Step 3: (Optional) Send the fused data to another destination (e.g., base station)

# Create another node as the base station

set base_station [$ns node]

$base_station set X_ 500; $base_station set Y_ 500; $base_station set Z_ 0

# Create a link between the fusion center and the base station

$ns duplex-link $fusion_center $base_station 2Mb 10ms DropTail

# Transmit the fused data to the base station

proc send_fused_data {fusion_center base_station} {

global ns

set tcp_fusion [new Agent/TCP]

set sink_fusion [new Agent/TCPSink]

$ns attach-agent $fusion_center $tcp_fusion

$ns attach-agent $base_station $sink_fusion

$ns connect $tcp_fusion $sink_fusion

set ftp_fusion [new Application/FTP]

$ftp_fusion attach-agent $tcp_fusion

$ftp_fusion start 2.5  ;# Start sending fused data at 2.5 seconds

}

# Schedule the fused data transmission to the base station

$ns at 2.5 “send_fused_data $fusion_center $base_station”

# Schedule the end of the simulation

$ns at 6.0 “finish”

# Run the simulation

$ns run

  1. Explanation of the Script
  • Sensor Nodes and Fusion Center: These three sensor nodes like sensor1, sensor2, sensor3 are transfer data to a fusion center (fusion_center).
  • TCP Traffic: Every sensor node sends its data using the TCP to the fusion center, that replicates the own data transmissions.
  • Data Fusion: At 2.0 seconds, the data_fusion process is performed at the fusion center. This technique aggregates the data received from all the sensors. For instance, the fusion process just prints a random value demonstrating the fused data.
  • Optional Fused Data Transmission: The fusion center transfers the fused data to a base station (base_station), after the data is fused.

In the script configures a basic instance of data fusion within NS2 in which sensor nodes are gather and forward the data to a fusion center that aggregates the data before sending it to another end.

  1. Run the Simulation

We can save the script as data_fusion.tcl then run it using:

ns data_fusion.tcl

It will generate a trace file (out.tr) and a NAM file (out.nam). The trace file records the packet transmissions, and the NAM file that permits to envision the data fusion process.

  1. Visualize the Simulation in NAM

We can visualize the simulation in the NAM tool:

nam out.nam

In the NAM, we will observe the sensor nodes sending their data to the fusion center. It transmits the fused data to the base station, after the fusion center receives the data,.

  1. Advanced Data Fusion Techniques

Given below are some furthered methods we can implement:

  • Weighted Data Fusion: Allocate weights to the data from various sensors and execute a weighted sum or average.
  • Hierarchical Data Fusion: Execute a multi-level data fusion in which intermediate nodes are execute local fusion before sending the data to the end fusion center.
  • Time-Series Fusion: Aggregate the data over time to make a more exact dataset.

Example: Weighted Data Fusion

proc data_fusion_weighted {sensor_data1 sensor_data2 sensor_data3} {

# Assign weights to each sensor’s data

set weight1 0.5

set weight2 0.3

set weight3 0.2

# Perform weighted fusion

set fused_data [expr $weight1*$sensor_data1 + $weight2*$sensor_data2 + $weight3*$sensor_data3]

puts “Fusion Center: Fused data value (weighted): $fused_data”

}

This demonstration had showcased more insights about how to implement Network Data fusion using Simulation tool that is NS2. We also offered some examples and evaluation process. If you need any extra information of the data fusion, we will provide them too.

Ns2project.com assists you in the implementation process by delivering results in Network Data Fusion using the ns2 tool. Please share all relevant project details with us to receive optimal support.