Install Xgraph in Ns2 Ubuntu

What is Xgraph?

         Xgraph is the program which is drawn as the graph based on X display which is functional with the given data read and the data files through the standard input of no files which are specialized. The Xgraph in Ns2 is utilized as the plot with some characteristics based on network parameters such as latency, jitter, delay, throughput and more. The applications based on X windows in Xgraph includes the following processes.

  • Bug fixes and portability
  • Interactive graphing and plotting
  • Directives and animation

What is Ns2?

           Network simulator 2 is abbreviated as Ns2 and it is one of the significant tools. Most significantly, it is used to perform various network simulation tasks through the utilization of programming languages such as TCL and C++. The Ns2 project is beneficial for the users mainly for the engineering students to proceed with the projects based on simulation environment. Ns2 is considered as the simple event driven simulation tool which is proved as the useful process to study the dynamic nature based communication networks.

Xgraph Installation Steps

           Hereby, our research professionals have highlighted the steps that are included with some instructions in SSH commands and the uses can follow the copy and paste process to avoid the spelling errors which is used for the accidental installation process in various packages.

  • Step 1
  • sudo apt-get update -y
  • Step 2
  • sudo apt-get install -y xgraph
  • Step 3
  • Check the system logs to confirm that there are no related errors

          In an additional note, the above mentioned steps includes -y flag and that means to assume yes with the silent installation process without asking about the questions in various cases.

Dependent Packages

  • libgcc1 on Ubuntu Server
  • Quick installation steps
  • Step 1 – sudo apt-get update -y
  • Step 2 – sudo apt-get install -y libgcc1
  • Step 3 – Check the system logs to confirm that there are no related errors
  • libc6 Package on Ubuntu
  • Installation steps
  • Step 1 – sudo apt-get update -y
  • Step 2 – sudo apt-get install -y libc6
  • Step 3 – Check the system logs to confirm that there are no related errors
  • libx11-6 on Ubuntu Server
  • Installation steps
  • Step 1 – sudo apt-get update -y
  • Step 2 – sudo apt-get install -y libx11-6
  • Step 3 – Check the system logs to confirm that there are no related errors

Log Axis Plots in Xgraph

          The users are capable to plot the logarithmic axes through the placement of options such as -xlog and/or -ylog options through the utilization of command line. The horizontal axis as the logarithmic functions through the utilization of -xlog and the vertical axis as the logarithmic through the functions of -ylog, it is considered as the notable process. The opposition of various standards linearly scaled axes which are logarithmic scaled axes and they are used to view the data span in large ranges. The data based on higher range values are displayed through the compressed fashion. “xgraph -ylog  test.dat” is considered as the example for this process.

Font Size in Xgraph

  • -fontsize_anno – Specify size of any graph annotations
  • Default = 8
  • -fontsize_titles – Specify size of the graph title and axes titles
  • Default = 12
  • -fontsize_axes – Size of the numbers on the axes scales are specified
  • Default = 9

          The above mentioned are the command lines based on font size specifications. The sizes of font are being deceptive in the printouts and it is summarized through the postscript files based on the screen displays. “xgraph -fontsize_titles 8” is considered as the Xgraph font size for your reference.

Piping Input in Xgraph

         The users are capable to pipe the data into Xgraph from various programs with the utilization of some symbols and the file name is based on the command lie. For instance, generate_data | xgraph -x_range 0 10 -y_range 0 10  – is considered as the piping input in Xgraph. Both the X and X axes are ranging to the prior of arrival with the piped input which is required for the axes ranges. In addition, the piped input is beneficial to create the hardcopy output based on non-interactive process.

Topology and Traffic Sources

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
$ns duplex-link $n0 $n3 1Mb 100ms
DropTail
$ns duplex-link $n1 $n3 1Mb 100ms
DropTail
$ns duplex-link $n2 $n3 1Mb 100ms
DropTail
$ns duplex-link $n3 $n4 1Mb 100ms
DropTail

            Aforementioned is the piece of code which is used in the creation process of topology. The traffic sources are attached towards the nodes such as n0, n1, n2 and more meanwhile the procedures have to be written and that is easy for the users to add more tragic sources and node generators. Below, we have highlighted the code that is used for this traffic sources.

proc attach-expoo-traffic { node sink size burst idle rate } {
#Get an instance of the simulator
set ns [Simulator instance]
#Create a UDP agent and attach it to the node
set source [new Agent/UDP]
$ns attach-agent $node $source
#Create an Expoo traffic agent and set its configuration parameters
set traffic [new Application/Traffic/Exponential]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
# Attach traffic source to the traffic generator
$traffic attach-agent $source
#Connect the source and the sink
$ns connect $source $sink
return $traffic
}

Recording Data in Output Files

        The process of recording data includes three output files and they have to open. Consequently, we have highlighted some lines that are appeared as the early process in the script based on TCL.

• set f0 [open out0.tr w]
• set f1 [open out1.tr w]
• set f2 [open out2.tr w]

           Additionally, in particular point the files have been closed and we have been used some modified finish process to proceed the functions and that finish process is highlighted in the following.

 

proc finish {} {
global f0 f1 f2{
#Close the output files{
close $f0{
close $f1{
close $f2{
#Call xgraph to display the results{
exec xgraph out0.tr out1.tr out2.tr -geometry 800x400 &{
exit 0{
}
{

Running the Simulation

        Our research professionals have years of experience in the process of installing Xgraph in Ns2 Ubuntu. Through that we have listed some events that are used to schedule the process.

$ns at 0.0 "record"
$ns at 10.0 "$source0 start"
$ns at 10.0 "$source1 start"
$ns at 10.0 "$source2 start"
$ns at 50.0 "$source0 stop"
$ns at 50.0 "$source1 stop"
$ns at 50.0 "$source2 stop"
$ns at 60.0 "finish"
$ns run

           The record procedure is processing and then it is rescheduled as itself with the particular time interval such as 0.5 seconds. The three traffic sources have been started at all the 10 seconds and ten it is stopped at 50 seconds. It is denoted as the finish procedure. While running the simulation, Xgraph window is considered to open with some time and that similar to the process which bursts the

  • First flow peak in 0.1 Mbit/s
  • Second at 0.2 Mbit/s
  • Third at 0.3 Mbit/s

          So far, we have shared our knowledge with most interesting and required development scenarios based on the install Xgraph in Ns2 Ubuntu. The research scholars can interact with our technical experts to clarify their research issues and we hope that you would have grasped for information about Xgraph in Ns2 through this article. In the long run, we are here with our best research team and technical developers to provide assistance. So, the research scholars can throw away the hesitation and feel free to contact us!