Tr File in Ns2
In general, the result of simulation based on Ns2 is defined as the provision of trace file along with the extension of .tr which includes the detailed information about all the occurred events.
Ns2 Code for Tr File Generation
For your reference, our technical programmers have highlighted the sample code based on network simulator 2 for the Tr file generation.
- Sample tcl code to declare the tr file generation object and generate tr file
set tracefd [open Simulation.tr w]
$ns trace-all $tracefd
- Sample tcl code for awk script execution based on generated tr file
exec awk -f Consuming_Energy.awk Simulation.tr > AODV_Consuming_Energy.tr
exec awk -f End_to_End_Delay.awk Simulation.tr > AODV_End_to_End_Delay.tr
Run Ns2 Tcl File
We have to run the Ns2 Tcl main file to generate the tr file which is based on Ns2 simulation through executing the following commands.
cd /home/research/Desktop/NS2_simulation
sudo ./ns Scenario-2.tcl
As an additional note, we have highlighted the acquired results based on the generated tr file.
To conclude this article, we are assuring that we provide the complete research assistance based on the execution of tr file in network simulator 2.