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

Other useful configuration parameters are to assign a separate flow id to traffic originating from this agent, to open a log filefor statistics, and a trace file for trace data 1 .The file tcl/mcast/srm-nam.tcl contains definitions that overload the agent’s send methods; this separates controltraffic originating from the agent by type. Each type is allocated a separate flowID. The traffic is separated into sessionmessages (flowid = 40), requests (flowid = 41), and repair messages (flowid = 42). The base flowid can be changed by settingglobal variable ctrlFid to one less than the desired flowid before sourcing srm-nam.tcl. To do this, the simulation scriptmust source srm-nam.tcl before creating any SRM agents. This is useful for analysis of traffic traces, or for visualizationin nam.Application Data Handling The agent does not generate any application data on its own; instead, the simulation user canconnect any traffic generation module to any SRM agent to generate data. The following code demonstrates how a trafficgeneration agent can be attached to an SRM agent:set packetSize 210set exp0 [new Application/Traffic/Exponential]$exp0 set packetSize_ $packetSize$exp0 set burst_time_ 500ms$exp0 set idle_time_ 500ms$exp0 set rate_ 100k;# configure traffic generator$exp0 attach-agent $srm0$srm0 set packetSize_ $packetSize$srm0 set tg_ $exp0$srm0 set app_fid_ 0;# attach application to SRM agent;# to generate repair packets of appropriate size;# pointer to traffic generator object;# fid value for packets generated by traffic generatorThe user can attach any traffic generator to an SRM agent. The SRM agent will add the SRM headers, set the destinationaddress to the multicast group, and deliver the packet to its target. The SRM header contains the type of the message, theidentity of the sender, the sequence number of the message, and (for control messages), the round for which this message isbeing sent. Each data unit in SRM is identified as 〈sender’s id, message sequence number〉.The SRM agent does not generate its own data; it does not also keep track of the data sent, except to record the sequencenumbers of messages received in the event that it has to do error recovery. Since the agent has no actual record of past data,it needs to know what packet size to use for each repair message. Hence, the instance variable packetSize_ specifies thesize of repair messages generated by the agent.Starting the Agent and Traffic GeneratorThe agent and the traffic generator must be started separately.$srm start$exp0 startAlternatively, the traffic generator can be started from the SRM Agent:$srm0 start-sourceAt start, the agent joins the multicast group, and starts generating session messages. The start-source triggers thetraffic generator to start sending data.1 Note that the trace data can also be used to gather certain kinds of trace data. We will illustrate this later.309

36.1.2 Other Configuration ParametersIn addition to the above parameters, the SRM agent supports additional configuration variables. Each of the variables describedin this section is both an OTcl class variable and an OTcl object’s instance variable. Changing the class variablechanges the default value for all agents that are created subsequently. Changing the instance variable of a particular agentonly affects the values used by that agent. For example,Agent/SRM set D1_ 2.0$srm set D1_ 2.0;# Changes the class variable;# Changes D1_ for the particular $srm object onlyThe default request and repair timer parameters [11] for each SRM agent are:Agent/SRM set C1_ 2.0 ;# request parametersAgent/SRM set C2_ 2.0Agent/SRM set D1_ 1.0 ;# repair parametersAgent/SRM set D2_ 1.0It is thus possible to trivially obtain two flavors of SRM agents based on whether the agents use probabilistic or deterministicsuppression by using the following definitions:Class Agent/SRM/Deterministic -superclass Agent/SRMAgent/SRM/Deterministic set C2_ 0.0Agent/SRM/Deterministic set D2_ 0.0Class Agent/SRM/Probabilistic -superclass Agent/SRMAgent/SRM/Probabilistic set C1_ 0.0Agent/SRM/Probabilistic set D1_ 0.0In a later section (Section 36.7), we will discuss other ways of extending the SRM agent.Timer related functions are handled by separate objects belonging to the class SRM. Timers are required for loss recovery andsending periodic session messages. There are loss recovery objects to send request and repair messages. The agent creates aseparate request or repair object to handle each loss. In contrast, the agent only creates one session object to send periodicsession messages. The default classes the express each of these functions are:Agent/SRM set requestFunction_Agent/SRM set repairFunction_Agent/SRM set sessionFunction_"SRM/request""SRM/repair""SRM/session"Agent/SRM set requestBackoffLimit_ 5 ;# parameter to requestFunction_Agent/SRM set sessionDelay_ 1.0 ;# parameter to sessionFunction_The instance procedures requestFunction{}, repairFunction{}, and sessionFunction{} can be used tochange the default function for individual agents. The last two lines are specific parameters used by the request and sessionobjects. The following section (Section 36.2) describes the implementation of theses objects in greater detail.310

Other useful configur<strong>at</strong>ion parameters are to assign a separ<strong>at</strong>e flow id to traffic origin<strong>at</strong>ing from this agent, to open a log filefor st<strong>at</strong>istics, <strong>and</strong> a trace file for trace d<strong>at</strong>a 1 .<strong>The</strong> file tcl/mcast/srm-nam.tcl contai<strong>ns</strong> definitio<strong>ns</strong> th<strong>at</strong> overload the agent’s send methods; this separ<strong>at</strong>es controltraffic origin<strong>at</strong>ing from the agent by type. Each type is alloc<strong>at</strong>ed a separ<strong>at</strong>e flowID. <strong>The</strong> traffic is separ<strong>at</strong>ed into sessionmessages (flowid = 40), requests (flowid = 41), <strong>and</strong> repair messages (flowid = 42). <strong>The</strong> base flowid can be changed by settingglobal variable ctrlFid to one less than the desired flowid before sourcing srm-nam.tcl. To do this, the simul<strong>at</strong>ion scriptmust source srm-nam.tcl before cre<strong>at</strong>ing any SRM agents. This is useful for analysis of traffic traces, or for visualiz<strong>at</strong>ionin nam.Applic<strong>at</strong>ion D<strong>at</strong>a H<strong>and</strong>ling <strong>The</strong> agent does not gener<strong>at</strong>e any applic<strong>at</strong>ion d<strong>at</strong>a on its own; i<strong>ns</strong>tead, the simul<strong>at</strong>ion user canconnect any traffic gener<strong>at</strong>ion module to any SRM agent to gener<strong>at</strong>e d<strong>at</strong>a. <strong>The</strong> following code demo<strong>ns</strong>tr<strong>at</strong>es how a trafficgener<strong>at</strong>ion agent can be <strong>at</strong>tached to an SRM agent:set packetSize 210set exp0 [new Applic<strong>at</strong>ion/Traffic/Exponential]$exp0 set packetSize_ $packetSize$exp0 set burst_time_ 500ms$exp0 set idle_time_ 500ms$exp0 set r<strong>at</strong>e_ 100k;# configure traffic gener<strong>at</strong>or$exp0 <strong>at</strong>tach-agent $srm0$srm0 set packetSize_ $packetSize$srm0 set tg_ $exp0$srm0 set app_fid_ 0;# <strong>at</strong>tach applic<strong>at</strong>ion to SRM agent;# to gener<strong>at</strong>e repair packets of appropri<strong>at</strong>e size;# pointer to traffic gener<strong>at</strong>or object;# fid value for packets gener<strong>at</strong>ed by traffic gener<strong>at</strong>or<strong>The</strong> user can <strong>at</strong>tach any traffic gener<strong>at</strong>or to an SRM agent. <strong>The</strong> SRM agent will add the SRM headers, set the destin<strong>at</strong>ionaddress to the multicast group, <strong>and</strong> deliver the packet to its target. <strong>The</strong> SRM header contai<strong>ns</strong> the type of the message, theidentity of the sender, the sequence number of the message, <strong>and</strong> (for control messages), the round for which this message isbeing sent. Each d<strong>at</strong>a unit in SRM is identified as 〈sender’s id, message sequence number〉.<strong>The</strong> SRM agent does not gener<strong>at</strong>e its own d<strong>at</strong>a; it does not also keep track of the d<strong>at</strong>a sent, except to record the sequencenumbers of messages received in the event th<strong>at</strong> it has to do error recovery. Since the agent has no actual record of past d<strong>at</strong>a,it needs to know wh<strong>at</strong> packet size to use for each repair message. Hence, the i<strong>ns</strong>tance variable packetSize_ specifies thesize of repair messages gener<strong>at</strong>ed by the agent.Starting the Agent <strong>and</strong> Traffic Gener<strong>at</strong>or<strong>The</strong> agent <strong>and</strong> the traffic gener<strong>at</strong>or must be started separ<strong>at</strong>ely.$srm start$exp0 startAltern<strong>at</strong>ively, the traffic gener<strong>at</strong>or can be started from the SRM Agent:$srm0 start-sourceAt start, the agent joi<strong>ns</strong> the multicast group, <strong>and</strong> starts gener<strong>at</strong>ing session messages. <strong>The</strong> start-source triggers thetraffic gener<strong>at</strong>or to start sending d<strong>at</strong>a.1 Note th<strong>at</strong> the trace d<strong>at</strong>a can also be used to g<strong>at</strong>her certain kinds of trace d<strong>at</strong>a. We will illustr<strong>at</strong>e this l<strong>at</strong>er.309

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

Saved successfully!

Ooh no, something went wrong!