The specific code for a simulation study is written in a main file as example (edu/0-prevj.rc) below:
# # Copyright (c) 2007 University of La Reunion - France # Author: Pascal ANELLI # http://personnel.univ-reunion.fr/panelli # All rights reserved. #---------------------------------------------------- # Goal: # TCP Before 88 # No congestion control in the end hosts #--------------------------------------------------- #==================================================== # BEGIN of ressource attributes #==================================================== # Simulation Model #================ # default value #-------------- Queue set limit_ 50 set opt(stoptime) 10 # Topology network #----------------- # number of core nodes set opt(routelength) 2 set opt(corelink) {{bw 0.7Mb} {tp 40ms} {queuesize 4} {queuetype DropTail}} # Hosts #------- set opt(pattern) { \ {{hook {0 1}} \ {nbnode 1} \ {nbflow 1} \ {bw {{1Mb 1Mb}}} \ {tp 5ms} \ {type TCP} \ {sourceparam {{tcpversion TCP/RFC793edu} \ {tcpsink TCPSink} \ {agentparam { \ {add793slowstart false} \ {add793additiveinc false} \ {add793exponinc false} \ {add793expbackoff false} \ {window 12} \ {packetSize 1250} \ } \ } \ }\ } \ {starttime 0} \ {transfersize -1} \ } \ } # Post Process #=============== # Analysis #--------- # from pkt file set conf(pkt) { \ {Flow { \ { {*} {activity throughputT}} \ } \ } \ {Queue { } \ } \ } # from param file set conf(param) { } set conf(parameter) {{bottlebw 0.7Mb} {weight 1/16} {timeinterval 0.2} {wrap 100} } # Plotting #--------- # Instructions to merge curves of the same graph set conf(plot) { } #==================================================== # END of ressource attributes #====================================================
SYNOPSIS ns test-suite.tcl [options] <ressources file name> <ressources file name>
Description of the simulation model (.rc file) OPTIONS -wd DIR Output directory (default ./tmp). -stoptime NUM Duration of simulation in seconds (simulated time). -nam 1 launch nam when the simulation is over. -namgraph 1 launch nam with session graph. -quiet 1 Display no graph. -verbose 1 print main instructions executed.
For example, to launch the simulation with the model described on this page called 0-prevj.rc:
ns test-suite.tcl -stoptime 20 -nam 1 edu/0-prevj.rc