The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ... The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

nmlab.korea.ac.kr
from nmlab.korea.ac.kr More from this publisher
12.07.2015 Views

X Other 40347 Educational use of NS and NAM 40447.1 Using NS for educational purposes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40447.1.1 Installing/building/running ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40447.1.2 The educational scripts’ inventory page: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40447.2 Using NAM for educational purposes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40511

Chapter 1IntroductionLet’s start at the very beginning,a very nice place to start,when you sing, you begin with A, B, C,when you simulate, you begin with the topology, 1. . .This document (ns Notes and Documentation) provides reference documentation for ns. Although we begin with a simplesimulation script, resources like Marc Greis’s tutorial web pages (originally at his web site, now at http://www.isi.edu/nsnam/ns/tutorial/) or the slides from one of the ns tutorials are problably better places to begin for the nsnovice.We first begin by showing a simple simulation script. This script is also available in the sources in ~ns/tcl/ex/simple.tcl.This script defines a simple topology of four nodes, and two agents, a UDP agent with a CBR traffic generator, and a TCPagent. The simulation runs for 3s. The output is two trace files, out.tr and out.nam. When the simulation completes atthe end of 3s, it will attempt to run a nam visualisation of the simulation on your screen.# The preambleset ns [new Simulator];# initialise the simulation# Predefine tracingset f [open out.tr w]$ns trace-all $fset nf [open out.nam w]$ns namtrace-all $nf1 with apologies to Rodgers and Hammerstein12

Chapter 1IntroductionLet’s start <strong>at</strong> the very beginning,a very nice place to start,when you sing, you begin with A, B, C,when you simul<strong>at</strong>e, you begin with the topology, 1. . .This document (<strong>ns</strong> <strong>Notes</strong> <strong>and</strong> <strong>Document<strong>at</strong>ion</strong>) provides reference document<strong>at</strong>ion for <strong>ns</strong>. Although we begin with a simplesimul<strong>at</strong>ion script, resources like Marc Greis’s tutorial web pages (originally <strong>at</strong> his web site, now <strong>at</strong> http://www.isi.edu/<strong>ns</strong>nam/<strong>ns</strong>/tutorial/) or the slides from one of the <strong>ns</strong> tutorials are problably better places to begin for the <strong>ns</strong>novice.We first begin by showing a simple simul<strong>at</strong>ion script. This script is also available in the sources in ~<strong>ns</strong>/tcl/ex/simple.tcl.This script defines a simple topology of four nodes, <strong>and</strong> two agents, a UDP agent with a CBR traffic gener<strong>at</strong>or, <strong>and</strong> a TCPagent. <strong>The</strong> simul<strong>at</strong>ion ru<strong>ns</strong> for 3s. <strong>The</strong> output is two trace files, out.tr <strong>and</strong> out.nam. When the simul<strong>at</strong>ion completes <strong>at</strong>the end of 3s, it will <strong>at</strong>tempt to run a nam visualis<strong>at</strong>ion of the simul<strong>at</strong>ion on your screen.# <strong>The</strong> preambleset <strong>ns</strong> [new Simul<strong>at</strong>or];# initialise the simul<strong>at</strong>ion# Predefine tracingset f [open out.tr w]$<strong>ns</strong> trace-all $fset nf [open out.nam w]$<strong>ns</strong> namtrace-all $nf1 with apologies to Rodgers <strong>and</strong> Hammerstein12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!