LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Making graphs of a simulation (https://www.linuxquestions.org/questions/linux-newbie-8/making-graphs-of-a-simulation-883191/)

ixma 05-28-2011 09:06 AM

Making graphs of a simulation
 
Hi plz anyone can help me in making My simulation graphs in Ns-2.34 in ubuntu how i can make them. my simualtion is about Home automation lighting control and i wnated to make 6 graphs

1) time VS Residaul energy ( remaining enregy of the nodes)like sensors (we have mentioned Insteon sensor and Switchlinc Dimmer)
use 9V battery in them. the 9V should be converted in joules and Energy on Y-axis should be in Joules and time on X-axis should be of simulation time
The graph would be showing after running the simulation 3000 times how much energy is remaining or how much energy is consumed in the nodes after sending 2000 packets.

2) Packet size Vs Delay, Delay on Y-axis and Packet size on X-axis with there units and the graph would be showing if Pacjet size increases how much delay is created.

3) Throughput Vs Badwidth. througput on Y-axis and Bandwidth on X-axis

4) Packets Loss Vs data rate
5) Packets sent Vs data rate
6) Packets received Vs data rate

The graphs mentioned above should be created from the trace file of the simulation.


PLZ PLZ anyone can help ssome sugestions

jschiwal 05-29-2011 09:26 PM

You might try extracting the data from the trace files to create files of just the data sets. Then use something like gnuplot to plot the data. The gnuplot documentation also includes a sample of using gnuplot with LaTeX. If the trace files are in a regular format, look at Awk or any general purpose scripting language to extract your datasets.

There is also a GraphViz package that might do the trick. It has plug-ins for a number of languages.

You could also use the graph package with METAPOST to produce graphs in your documentation.

A lot depends how you want to (or need to) publish your results.

eightcien 05-29-2011 09:28 PM

Try Gnuplot
 
Gnuplot (http://www.gnuplot.info/) can be used to produce very nice plots. You can use the program interactively to generate a plot that looks good, then save the commands to a file so that you can execute them again in "batch mode" on all your data.

In your case, a simple way to get started is to create a file containing two numeric values per line: the first column contains the x-axis values and the second column contains the y-axis values. Start gnuplot and type the following command at the prompt, where "my.data" is the name of the file containing your x/y values:

Code:

plot 'my.data'
That should display a simple 2D graph. Typing "help" at the gnuplot prompt gives you access to an online manual. Typing "help plot" will tell you everything you need to know about the "plot" command.

If you know Python (or are willing to learn), then matplotlib (http://matplotlib.sourceforge.net/) is excellent as well.

theNbomr 05-30-2011 12:11 AM

If you post a sample of your data file(s), there will probably be a long list of example code to demonstrate parsing the data and feeding it to gnuplot. The list will no doubt include all of the common scripting languages, as well as few we've never heard of, and an assortment of other obscure (but interesting) methods. One of the usual suspects will demonstrate a 7 character one-liner that runs in less-than-zero time.
--- rod.

ixma 05-30-2011 10:03 AM

thanx
 
hey thanx all, i m trying gnuplot now but can anyone tell how gnu plot works with Ns2.34??? :/

Nylex 05-30-2011 10:09 AM

Gnuplot is just a general purpose piece of software for plotting. You need to give it data that it can understand, as others have hinted. Where is the data from ns-2 stored, or is it just printed to stdout? Is it in ASCII or binary? I don't think Gnuplot can read binary files (I've not used it in a while, so I don't remember), so you may just have to use plain ASCII.

ixma 05-30-2011 10:22 AM

have to write awk file to extract data from trace file and then give awk command and plot graph by giving xgraph command now i cannot understand how i will plot graph using gnu plot and how i will give data to it...

Nylex 05-30-2011 10:26 AM

Read the documentation to see what kind of format Gnuplot requires and modify your AWK scripts accordingly?

Also, please make sure you use punctuation in your posts. It's difficult to read posts that are essentially one long sentence.

ixma 05-30-2011 10:36 AM

thanx


All times are GMT -5. The time now is 03:26 AM.