This shows you the differences between two versions of the page.
isrm:laboratoare:01 [2016/09/28 19:27] dragos.niculescu |
isrm:laboratoare:01 [2016/10/05 12:46] (current) dragos.niculescu |
||
---|---|---|---|
Line 1: | Line 1: | ||
==== Laboratorul 1 ==== | ==== Laboratorul 1 ==== | ||
- | === Jucăm === | + | Citim tutoriale și rulăm exemple. Textul de mai jos este bazat pe ghidul [[ http://nile.wpi.edu/NS/ | NS by example ]] de J. Chung și M. Claypool. |
- | [[ http://www.medcalf.com/games/cisco_games/game_page.html?userName=Melissa&game=wireless | Wireless Explorer ]] doar câteva nivele LOL. | + | |
- | === Introducere în ns2 === | + | == Introducere în ns2 == |
- | Citim tutoriale și rulăm exemple. Text de J. Chung și M. Claypool reprodus de pe [[ http://nile.wpi.edu/NS/ | NS by example ]] | + | |
- | == Purpose == | + | |
- | NS (version 2) is an object-oriented, discrete event driven network simulator developed at UC Berkely written in C++ and OTcl. NS is primarily useful for simulating local and wide area networks. Although NS is fairly easy to use once you get to know the simulator, it is quite difficult for a first time user, because there are few user-friendly manuals. Even though there is a lot of documentation written by the developers which has in depth explanation of the simulator, it is written with the depth of a skilled NS user. The purpose of this project is to give a new user some basic idea of how the simultor works, how to setup simulation networks, where to look for further information about network components in simulator codes, how to create new network components, etc., mainly by giving simple examples and brief explanations based on our experiences. Although all the usage of the simulator or possible network simulation setups may not be covered in this project, the project should help a new user to get started quickly. | + | |
+ | NS-2 este un simulator bazat pe evenimente dezvoltat la UC Berkely scris in C++ si OTcl. NS-2 este în primul rând util pentru simularea rețelelor LAN și WAN, dar și pentru rețele wireless, adhoc, de senzori. Cu toate ca NS este destul de ușor de utilizat pentru avansați, poate părea dificil la prima utilizare, deoarece există puține manuale user-friendly. Chiar dacă există o mulțime de documente scrise de către dezvoltatori, care conțin explicații aprofundate ale simulatorului, acestea sunt scrise pentru utilizatorii NS-2 avansați. Această secțiune oferă o idee de bază a modului în care funcționează simulatorul, cum se pregătește o simulare, unde se găsesc componentele interne, cum se configurează componentele de rețea, etc. În principal se prezintă exemple simple și explicații bazate pe experimente simple, familiare unui student care a luat un curs introductiv de rețele. | ||
- | == OTcl: The User Language == | + | == Limbajul OTcl == |
- | As mentioned in the overview section, NS is basically an OTcl interpreter with network simulation object libraries. It is very useful to know how to program in OTcl to use NS. This section shows an example Tcl and OTcl script, from which one can get the basic idea of programming in OTcl. These examples are from the 5th VINT/NS Simulation Tutorial/Workshop. This section and the sections after assumes that the reader installed NS, and is familiar with C and C++. | + | |
- | Example 1 is a general Tcl script that shows how to create a procedure and call it, how to assign values to variables, and how to make a loop. Knowing that OTcl is Object-orieneted extension of Tcl, it is obvious that all Tcl commands work on OTcl - the relationship between Tcl and Otcl is just same as C and C++. To run this script you should download ex-tcl.tcl, and type "ns ex-tcl.tcl" at your shell prompt - the command "ns" starts the NS (an OTcl interpreter). You will also get the same results if you type "tcl ex-tcl.tcl", if tcl8.0 is installed in your machine. | + | NS-2 este în esență un interpretor de OTcl cu biblioteci de obiecte C++ specializate în simularea rețelelor. Este necesar să se cunoască sumar programarea în OTcl pentru a utiliza NS-2. Această secțiune prezintă un exemplu OTcl care ilustrează ideea de bază a programării în OTcl, exemplu importat din manualul oficial NS-2. Această secțiune, ca și secțiunile următoare presupun că cititorul a instalat NS-2, și este familiarizat cu shell și cu C++. |
+ | |||
+ | Primul exemplu este un script general OTcl, care arată modul de declarare o procedură și a o apela, modul de a atribui valori variabilelor, și modul de a implementa o buclă. OTcl este de fapt extensia orientată obiect a Tcl(pronunțat "tickle"), relația dintre Tcl și Otcl este la fel ca și cea dintre C și C++, dar în acest laborator rareori sunt folosite obiectele în OTcl. Pentru a rula acest script rulați "ns ex-tcl.tcl" la promptul shell - comanda "ns" execută NS-2 (interpretorul OTcl). Veți obține aceleași rezultate dacă tastați "tclsh ex-tcl.tcl", în cazul în care tcl8.0 este instalat pe mașina dumneavoastră. | ||
<file tcl ex-tcl.tcl> | <file tcl ex-tcl.tcl> | ||
Line 35: | Line 33: | ||
</file> | </file> | ||
- | In Tcl, the keyword proc is used to define a procedure, followed by an procedure name and arguments in curly brackets. The keyword set is used to assign a value to a variable. [expr ...] is to make the interpreter calculate the value of expression within the bracket after the keyword. One thing to note is that to get the value assigned to a variable, $ is used with the variable name. The keyword puts prints out the following string within double quotation marks. The following shows the result of Example 1. | + | |
+ | În Tcl, cuvântul cheie ''proc'' este folosit pentru a defini o procedură, urmat de un nume de procedură și argumentele în acolade. Cuvântul cheie ''set'' este folosit pentru a atribui o valoare unei variabile. ''[Expr ...]'' este pentru a calcula valoarea expresiei între paranteze drepte, după cuvântul cheie. Un lucru de remarcat este faptul că pentru a obține valoarea atribuită unei variabile, ''$'' este utilizat cu numele variabilei (ca în shell). Cuvântul cheie ''puts'' imprimă șirul de caractere la consolă. Rulând exemplul de mai sus, se obține: | ||
<code> | <code> | ||
k < 5, pow = 1.0 | k < 5, pow = 1.0 | ||
Line 49: | Line 49: | ||
</code> | </code> | ||
- | == Simple Simulation Example == | + | == Primul exemplu de simulare == |
- | This section shows a simple NS simulation script and explains what each line does. Example 3 is an OTcl script that creates the simple network configuration and runs the simulation scenario in the figure below. To run this simulation, download "ns-simple.tcl" and type "ns ns-simple.tcl" at your shell prompt. | + | Această secțiune prezintă un script simplu NS-2 si explica ce face fiecare linie. Exemplul este un script OTcl care creează o configurație de rețea simplă și rulează scenariul de simulare din figura de mai jos. Pentru a rula această simulare, descărcați "ns-simple.tcl" și rulați "ns ns-simple.tcl" în shell. |
- | {{ :isrm:laboratoare:01:lab1_ns_simple.gif?nolink|}} | + | {{ :isrm:laboratoare:01:lab1_ns_simple.png?nolink|}} |
- | A Simple Network Topology and Simulation Scenario | + | Această rețea este formată din 4 noduri (n0, n1, n2, n3), așa cum se arată în figura de mai sus. Link-urile duplex între n0 și n2, și n1 și n2 au capacitatea 2Mbps[Megabit/s] și 10ms de întârziere. Link-ul duplex între n2-n3 are capacitatea de 1.7Mbps și 20ms de întârziere. Fiecare nod folosește la ieșire o coadă DropTail, a cărei mărime este de 10 pachete. Un agent "TCP" este atașat la n0, și este stabilită o conexiune la un sink TCP atașat la n3. În mod implicit, dimensiunea maximă a unui pachet pe care un agent de TCP poate genera este 1KByte. Un sink TCP generează și trimite pachete ACK către expeditor (agent TCP) și livrează la aplicație pachetele primite. Un agent UDP, care este atașat la n1 este conectat la un agent sink (LossMonitor) atașat la n3. Un agent LossMonitor doar contorizează pachetele primite. Aplicații de tio FTP și generator de trafic CBR sunt atașate la agenții TCP șiUDP respectivi, iar CBR este configurat pentru a genera pachete de 1000 bytes la rata de 1Mbps. Aplicația CBR este setată să pornească de la 0.1s, și să se oprească la 14,5 sec, iar FTP pornește de la 1.0s și se oprește la 14.0s. |
- | This network consists of 4 nodes (n0, n1, n2, n3) as shown in above figure. The duplex links between n0 and n2, and n1 and n2 have 2 Mbps of bandwidth and 10 ms of delay. The duplex link between n2 and n3 has 1.7 Mbps of bandwidth and 20 ms of delay. Each node uses a DropTail queue, of which the maximum size is 10. A "tcp" agent is attached to n0, and a connection is established to a tcp "sink" agent attached to n3. As default, the maximum size of a packet that a "tcp" agent can generate is 1KByte. A tcp "sink" agent generates and sends ACK packets to the sender (tcp agent) and frees the received packets. A "udp" agent that is attached to n1 is connected to a "null" agent attached to n3. A "null" agent just frees the packets received. A "ftp" and a "cbr" traffic generator are attached to "tcp" and "udp" agents respectively, and the "cbr" is configured to generate 1 KByte packets at the rate of 1 Mbps. The "cbr" is set to start at 0.1 sec and stop at 4.5 sec, and "ftp" is set to start at 1.0 sec and stop at 4.0 sec. | ||
<file tcl ns-simple.tcl> | <file tcl ns-simple.tcl> | ||
Line 65: | Line 64: | ||
$ns color 1 Blue | $ns color 1 Blue | ||
$ns color 2 Red | $ns color 2 Red | ||
+ | |||
+ | #Open the NAM trace file | ||
+ | set nf [open out.nam w] | ||
+ | $ns namtrace-all $nf | ||
+ | |||
+ | #ns trace file | ||
+ | set tracefd [open simple.tr w] | ||
+ | $ns use-newtrace | ||
+ | $ns trace-all $tracefd | ||
+ | |||
#Create four nodes | #Create four nodes | ||
Line 117: | Line 126: | ||
$cbr set rate_ 1mb | $cbr set rate_ 1mb | ||
$cbr set random_ false | $cbr set random_ false | ||
- | |||
- | #Open the NAM trace file | ||
- | set nf [open out.nam w] | ||
- | $ns namtrace-all $nf | ||
#Define a 'finish' procedure | #Define a 'finish' procedure | ||
Line 150: | Line 155: | ||
</file> | </file> | ||
+ | == Descrierea script-ului == | ||
- | The following is the explanation of the script above. In general, an NS script starts with making a Simulator object instance. | + | În general, un script NS-2 începe cu o instanță a obiectului simulator: |
+ | * ''set ns [new Simulator]'' generează un obiect de tip simulator și îl atribuie variabilei //ns// (caracterele cursive sunt folosite pentru variabile și valori). Această linie: | ||
+ | * inițializează formatul pachetelor (ignorați acest lucru deocamdată) | ||
+ | * crează un planificator | ||
+ | * selectează formatul adreselor (ignorați acest lucru deocamdată) | ||
+ | * Obiectul "simulator" are funcții de membru care: | ||
+ | * crează obiecte compuse, cum ar fi nodurile și legăturile (descrise mai târziu) | ||
+ | * conectează componentele de rețea create (de ex., ''attach-agent'') | ||
+ | * setează parametrii componentelor de rețea (mai ales pentru obiectele compuse) | ||
+ | * crează conexiuni între agenți (de ex., Face legătura între un TCP și sink) | ||
+ | * specifică opțiunile NAM (network animator) | ||
- | * ''set ns [new Simulator]'' generates an NS simulator object instance, and assigns it to variable ns (italics is used for variables and values in this section). What this line does is the following: | + | Cele mai multe dintre funcții sunt pentru configurarea simularii și pentru planificare, iar unele dintre ele sunt pentru animatorulul NAM. Multe alte setări ale simulatorului pot fi consultate în fișierul ''ns-2 / TCL / lib / ns-lib.tcl''. |
- | + | ||
- | * Initialize the packet format (ignore this for now) | + | |
- | * Create a scheduler (default is calendar scheduler) | + | |
- | * Select the default address format (ignore this for now) | + | |
- | + | ||
- | The "Simulator" object has member functions that do the following: | + | |
- | + | ||
- | * Create compound objects such as nodes and links (described later) | + | |
- | * Connect network component objects created (ex. attach-agent) | + | |
- | * Set network component parameters (mostly for compound objects) | + | |
- | * Create connections between agents (ex. make connection between a "tcp" and "sink") | + | |
- | * Specify NAM display options | + | |
- | + | ||
- | Most of member functions are for simulation setup (referred to as plumbing functions in the Overview section) and scheduling, however some of them are for the NAM display. The "Simulator" object member function implementations are located in the "ns-2/tcl/lib/ns-lib.tcl" file. | + | |
- | + | ||
- | * ''$ns color fid color'' is to set color of the packets for a flow specified by the flow id (fid). This member function of "Simulator" object is for the NAM display, and has no effect on the actual simulation. | + | |
- | + | ||
- | * ''$ns namtrace-all file-descriptor'' This member function tells the simulator to record simulation traces in NAM input format. It also gives the file name that the trace will be written to later by the command $ns flush-trace. Similarly, the member function trace-all is for recording the simulation trace in a general format. | + | |
- | + | ||
- | * ''proc finish {}'' is called after this simulation is over by the command $ns at 5.0 "finish". In this function, post-simulation processes are specified. | + | |
- | + | ||
- | * ''set n0 [$ns node]'' The member function node creates a node. A node in NS is compound object made of address and port classifiers (described in a later section). Users can create a node by separately creating an address and a port classifier objects and connecting them together. However, this member function of Simulator object makes the job easier. To see how a node is created, look at the files: "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-node.tcl". | + | |
- | + | ||
- | * ''$ns duplex-link node1 node2 bandwidth delay queue-type'' creates two simplex links of specified bandwidth and delay, and connects the two specified nodes. In NS, the output queue of a node is implemented as a part of a link, therefore users should specify the queue-type when creating links. In the above simulation script, DropTail queue is used. If the reader wants to use a RED queue, simply replace the word DropTail with RED. The NS implementation of a link is shown in a later section. Like a node, a link is a compound object, and users can create its sub-objects and connect them and the nodes. Link source codes can be found in "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl" files. One thing to note is that you can insert error modules in a link component to simulate a lossy link (actually users can make and insert any network objects). Refer to the NS documentation to find out how to do this. | + | |
- | + | ||
- | * ''$ns queue-limit node1 node2 number'' This line sets the queue limit of the two simplex links that connect node1 and node2 to the number specified. At this point, the authors do not know how many of these kinds of member functions of Simulator objects are available and what they are. Please take a look at "ns-2/tcl/libs/ns-lib.tcl" and "ns-2/tcl/libs/ns-link.tcl", or NS documentation for more information. | + | |
- | + | ||
- | * ''$ns duplex-link-op node1 node2 ...'' The next couple of lines are used for the NAM display. To see the effects of these lines, users can comment these lines out and try the simulation. | + | |
- | Now that the basic network setup is done, the next thing to do is to setup traffic agents such as TCP and UDP, traffic sources such as FTP and CBR, and attach them to nodes and agents respectively. | + | |
- | * ''set tcp [new Agent/TCP]'' This line shows how to create a TCP agent. But in general, users can create any agent or traffic sources in this way. Agents and traffic sources are in fact basic objects (not compound objects), mostly implemented in C++ and linked to OTcl. Therefore, there are no specific Simulator object member functions that create these object instances. To create agents or traffic sources, a user should know the class names these objects (Agent/TCP, Agnet/TCPSink, Application/FTP and so on). This information can be found in the NS documentation or partly in this documentation. But one shortcut is to look at the "ns-2/tcl/libs/ns-default.tcl" file. This file contains the default configurable parameter value settings for available network objects. Therefore, it works as a good indicator of what kind of network objects are available in NS and what are the configurable parameters. | + | * ''$ns color fid color'' stabilește culoarea pachetelor pentru un flux specificat de id-ul fluxului (fid). Acest membru al obiectului "simulator" este pentru afișajul NAM, și nu are nici un efect asupra simulării propriuzise. |
+ | * ''$ns namtrace-all file-descriptor'' Acest membru specifică un fișier trace de simulare în format specific NAM. Acesta oferă numele de fișier pe care informațiile de trace vor fi scrise mai târziu de comandă ''$ns flush-trace''. În mod similar, ''trace-all'' este pentru înregistrarea trace-urilor de simulare într-un format general. | ||
+ | * ''proc finish {}'' este rulată la sfârșitul simulării când se interpretează comanda ''$ns at 15.0 "finish"''. În această funcție, sunt specificate diverse procesări post-simulare. | ||
+ | * ''set n0 [$ns node]'' Funcția membru ''node'' creează un nod nou. Un nod în NS-2 este un obiect compus din adresa si port clasificator. Utilizatorii pot crea un nod prin crearea separată a adresei și a unui port clasificator, și conectarea lor ulterioară. Pentru a vedea modul în care se creează un nod, se pot consulta fișierele: ''ns-2 / tcl / libs / ns-lib.tcl'' și ''ns-2 / tcl / libs / ns-node.tcl''. | ||
+ | * ''$ns duplex-link node1 node2 bandwidth delay queue-type'' creează **două** legături simplex de bandă și întârziere specificate, pentru a conecta cele două noduri. În NS-2, coada de ieșire a unui nod este implementată ca parte a unei legături, prin urmare, utilizatorii ar trebui să specifice tipul de coadă atunci când crează legături. În script-ul de mai sus, este utilizată coadă de tip DropTail. În cazul în care se dorește o coadă RED, pur și simplu se înlocuiește DropTail cu RED. Implementarea NS-2 a unei legături este prezentată într-o secțiune ulterioară. Ca și nodurile, link-urile sunt obiect compuse, deci se pot crea sub-obiecte ce pot fi conectate. Codul sursă pentru legături poate fi găsit în "ns-2 / tcl / libs / ns-lib.tcl" și "ns-2 / tcl / libs / ns-link.tcl". Se remarcă faptul că se pot insera modulele de eroare într-o legătură pentru a simula o legătură cu pierderi (de fapt, utilizatorii pot crea și insera orice obiect de rețea). Consultați documentația pentru NS pentru detalii. | ||
+ | * ''$ns queue-limit node1 node2 number'' Această linie stabilește dimensiunea cozii de așteptare a celor două legături simplex care conectează node1 și node2. Aruncați o privire la "ns-2 / tcl / libs / ns-lib.tcl" și "ns-2 / tcl / libs / ns-link.tcl", sau documentația NS-2 pentru mai multe informații. | ||
+ | * ''$ns duplex-link-op node1 node2 …'' Urmatoarea linie este folosită pentru afișajul NAM. Pentru a vedea efectele ei, utilizatorii pot comenta și rerula simularea. | ||
- | * ''$ns attach-agent node agent'' The attach-agent member function attaches an agent object created to a node object. Actually, what this function does is call the attach member function of specified node, which attaches the given agent to itself. Therefore, a user can do the same thing by, for example, $n0 attach $tcp. Similarly, each agent object has a member function attach-agent that attaches a traffic source object to itself. | + | Odată configurată rețeaua de bază, trebuie configurați agenții de generare/consum trafic, cum ar fi TCP și UDP, aplicațiile de generare/consum trafic, cum ar fi FTP și CBR. Acestea trebuie atașate nodurilor și agenților într-un mod similar cu rularea aplicațiilor peste anumite protocoale în nodurile reale. |
- | + | ||
- | * ''$ns connect agent1 agent2'' After two agents that will communicate with each other are created, the next thing is to establish a logical network connection between them. This line establishes a network connection by setting the destination address to each others' network and port address pair. | + | * ''set tcp [new Agent/TCP]'' Această linie crează un agent TCP. Agenții și sursele de trafic sunt obiecte de bază în cea mai mare parte implementate în C++ și "legate" în OTcl. Prin urmare, nu există funcții specifice ale obiectului simulator care creează aceste instanțe. Pentru a crea agenți sau surse de trafic, trebuie să se cunoască numele clasei (''Agent/TCP'', ''Agent/TCPSink'', ''Application/FTP'', etc). Aceste informații pot fi găsite rapid în fișierul "ns-2/tcl/libs/ns-default.tcl". Acest fișier conține configurări implicite pentru diverse obiecte. Sursele sunt un bun indicator pentru obiectele disponibile în NS-2 și ce parametrii lor. |
- | Assuming that all the network configuration is done, the next thing to do is write a simulation scenario (i.e. simulation scheduling). The Simulator object has many scheduling member functions. However, the one that is mostly used is the following: | + | * ''$ns attach-agent node agent'' Funcția ''atttach-agent'' conectează un obiect agent la un nod. |
+ | * ''$ns connect agent1 agent2'' După ce s-au creat doi agenți care se vor comunicatrebuie stabilită o conexiune logică între ei. Această linie stabilește o conexiunea prin setarea reciprocă a adreselor și a porturilor. | ||
+ | |||
+ | Odată configurația rețelei specificată, următorul lucru este implementarea unui scenariu de simulare. Obiectul Simulator are funcția ''at'': | ||
+ | |||
+ | * ''$ns at time “string”'' Această funcție programează executarea șirului specificat la un moment de simulare. De exemplu, ''$ns at 0.1 "$CBR start"'' va face scheduler-ul să apeleze o funcție membru de start al obiectului ''$CBR'' la momentul ''0.1s''. În NS-2, o sursă de trafic nu transmite date reale, ci notifică agentul care de la baza o anumită cantitate de date, iar agentul, creează pachete și le trimite în mod fidel implementărilor din kernel, **considerând un CPU cu viteză infinită**. | ||
- | * ''$ns at time "string"'' This member function of a Simulator object makes the scheduler (scheduler_ is the variable that points the scheduler object created by [new Scheduler] command at the beginning of the script) to schedule the execution of the specified string at given simulation time. For example, $ns at 0.1 "$cbr start" will make the scheduler call a start member function of the CBR traffic source object, which starts the CBR to transmit data. In NS, usually a traffic source does not transmit actual data, but it notifies the underlying agent that it has some amount of data to transmit, and the agent, just knowing how much of the data to transfer, creates packets and sends them. | + | După ce s-au efectuat toate specificațiile de configurare a rețelei, specificat procedura post-simulare, singurul lucru rămas este rularea propriu-zisă. Acest lucru se face cu funcția ''$ns run''. |
- | After all network configuration, scheduling and post-simulation procedure specifications are done, the only thing left is to run the simulation. This is done by ''$ns run.'' {{ :isrm:laboratoare:01:lab1-nam.png?direct&200|}} | + | |
- | * La rularea cu ''ns ./ns-simple.tcl'' , se execută scriptul care generează "filmul simulării" out.name, și se lansează animatorul ''nam''. Rulați slide-ul în animator pentru a accelera filmul, observați transferul pachetelor și comportarea cozii din nodul 2 | + | * La rularea din shell ''ns ./ns-simple.tcl'', se execută simularea și se generează "filmul simulării" out.nam, apoi se lansează animatorul ''nam''. Rulați slide-ul în animator pentru a accelera filmul, observând transferul pachetelor și comportarea cozii din nodul 2. |
== Trasarea unui grafic == | == Trasarea unui grafic == | ||
ns2 permite implementarea cu ușurință a procedurilor specializate de generare de loguri. Aceste proceduri sunt apelate periodic în timpul simulării și permit adresarea tuturor datelor specifice nodurilor, fluxurilor, cozilor, și ale celorlalte entități din rețea. | ns2 permite implementarea cu ușurință a procedurilor specializate de generare de loguri. Aceste proceduri sunt apelate periodic în timpul simulării și permit adresarea tuturor datelor specifice nodurilor, fluxurilor, cozilor, și ale celorlalte entități din rețea. | ||
- | În partea de final a scriptului de mai sus, inserați codul următor. Apelată periodic, această procedură contorizează numărul de octe ți primiți de destinația UDP, și numărul de octeți confirmați la sursa TCP. În acest mod, se poate calcula debitul obținut de cele două fluxuri pe intervale fixe de timp. Cele două valori sunt stocate periodic într-un fișier text ''out.tr''. | + | În partea de final a scriptului de mai sus, inserați patch-ul următor. Apelată periodic, această procedură contorizează numărul de octe ți primiți de destinația UDP, și numărul de octeți confirmați la sursa TCP. În acest mod, se poate calcula debitul obținut de cele două fluxuri pe intervale fixe de timp. Cele două valori sunt stocate periodic într-un fișier text ''out.tr''. |
<file tcl> | <file tcl> | ||
#Open a trace file | #Open a trace file | ||
Line 236: | Line 233: | ||
</file> | </file> | ||
În plus, înainte de a demara simularea, trebuie să armăm procedura record cu ''$ns at 0.0 "record"''. | În plus, înainte de a demara simularea, trebuie să armăm procedura record cu ''$ns at 0.0 "record"''. | ||
- | După execuția scriptului, se vor lansa automat atât fereastra animatorului, cât și o fereastră gnuplot care afișează conținutul fișierului trace ''out.tr'' | + | După execuția scriptului, se vor lansa automat atât fereastra animatorului, cât și o fereastră gnuplot care afișează conținutul fișierului trace ''out.tr''. {{ :isrm:laboratoare:01:lab1-gnuplot.png?nolink&300 |}} |
+ | |||
+ | == Task-uri == | ||
- examinați cu editorul de text conținutul fișierelor ''out.nam'' și ''out.tr'' | - examinați cu editorul de text conținutul fișierelor ''out.nam'' și ''out.tr'' | ||
- Ce reprezintă axele x, y? Explicați comportarea graficelor. | - Ce reprezintă axele x, y? Explicați comportarea graficelor. | ||
- Măriți coada de la link-ul bottleneck la 100. Cum explicați noua comportare? | - Măriți coada de la link-ul bottleneck la 100. Cum explicați noua comportare? | ||
- Coada aruncă pachete TCP în mod disproporționat. De ce? Folosiți o coadă SFQ pentru a remedia situația. | - Coada aruncă pachete TCP în mod disproporționat. De ce? Folosiți o coadă SFQ pentru a remedia situația. | ||
+ | - În prezent se măsoară debitul la fiecare 250ms. Experimentați cu diverse rezoluții de măsurare în funcția "record". | ||
+ | - **Facultativ**: monitorizarea cozii ([[http://www.mathcs.emory.edu/~cheung/Courses/558-old/Syllabus/90-NS/trace.html#QMon| formatul ]] trace-ului queue) | ||
+ | <code tcl> | ||
+ | set qfile [$ns monitor-queue $n2 $n3 [open queue.tr w] 0.1] | ||
+ | [$ns link $n2 $n3] queue-sample-timeout | ||
+ | </code> | ||
+ | |||
+ | |||
+ | == Ne jucăm! == | ||
+ | [[ http://www.cisco.com/E-Learning/prod/curriculum/cco_tdo_ldd/demos/DandEguideSPN/SpaceGame/remote.html | Wireless Explorer ]] câteva nivele LOL. | ||
+ | |||