Hi,
These extracted from blog's Mohit :
AWK scripts (.awk), which are used to extract the necessary information from
trace files (.tr) are also useful to plot graphs using Xgraph (.xgr) utility
of NS-2. However, the AWK scripts that are used to plot graphs differ from
the AWK scripts that just print the values on the terminal.
I will try to explain the difference between these two types of AWK scripts
with the help of an example. Assume that we have designed a tcl script named
“energy.tcl” which simulates a network for 100 seconds. We run this tcl
script with the following command:
*ns energy.tcl*
After executing the tcl script we get a trace file (.tr) and a NAM file
(.nam) i.e. “energy.tr” and “energy.nam”. Now we may have two scenarios as
explained below:
1. We want the value of residual (remaining) energy of a node *at the end
of the simulation*. (Here graph of Time v/s Residual energy is not
required).
2. We want the value of residual (remaining) energy of a node *at each
instance of time* i.e from beginning of the simulation to the end of the
simulation. (Time v/s Residual energy graph is required to observe the
decrease in the total energy of a node).
For both of the above mentioned scenarios we need to design two different
AWK scripts. However, the main logic to calculate the residual energy will
remain the same. Only the way we print the values differs.
Let *scen1.awk* be the awk file for first scenario and *scen2.awk* be the
awk file for second scenario. scen1.awk should be designed such that when we
run it by using the following command:
*awk -f scen1.awk energy.tr*
it should print the residual (remaining) energy of a node on the terminal.
And scen2.awk should be designed such that when we run it by using the
following command:
*awk -f scen2.awk energy.trenergy.xgr*
it should print two values in “energy.xgr”: time and residual (remaining)
energy of a node.
If you open “energy.xgr” you will notice that there are two columns
created. In first column, values related to “time” are printed and in
another column values related to “residual energy” are printed. The values
in first column form X-axis of the graph and the values in second column
form Y-axis of the graph (thus you get a graph of Time v/s Residual
Energy). Give the following command to see the graph:
*xgraph energy.xgr*
Default background color of the graph is grey. If you want a graph with
background color as white, give the following command:
*xgraph energy.xgr -bg white
Besides, you can plot graph by using gnuplot (search google gnuplot for
more information).
Hope it helps,
regards.
phathienhung.
*
2011/4/11 兰天 lantian0...@163.com
hi,
I also work on the simulation of 802.15.4,
I hope that we could discuss together
Varrick
At 2011-04-11 08:17:24,Mossy Mozila mossymb...@gmail.com wrote:
Hie
I'm also facing the same problem if it happens that someone helped you can
you just post me the idea at mossymb...@gmail.com.
Thanks in advance
mikes1313 wrote:
rajeev joshi-3 wrote:
Hell,
I simulated IEEE 802.15.4 and Got the throughput delay, and can I draw
the
exponential graphs in xgraph if yes please tell how otherwise please
anyone
tell any software that plots .
Waiting for ur reply.
--
Jeeva Rajeeva
I am facing the same problem with Xgraph from what I now you can easily
draw graphs through excel. Can you please provide me your awk scripts
for
throughput-delay because I am still facing problms with mine.
THANKS MIKE
--
View this message in context:
http://old.nabble.com/Drawing-exponential-graphs-tp31362766p31366534.html
Sent from the ns-users mailing list archive at Nabble.com.