Simulation of Networks
Traffic generation in ns
Traffic generation is described in Chapter 32 of the ns Manual.
Some extracts:
32.5 Applications objects
An application object may be of two types, a traffic generator or a
simulated application. Traffic generator objects generate traffic and can
be of four types, namely, exponential, pareto, CBR and traffic trace.
- Application/Traffic/Exponential objects
- Exponential traffic objects generate On/Off traffic. During "on" periods,
packets are generated at a constant burst rate. During "off" periods, no
traffic is generated. Burst times and idle times are taken from
exponential distributions. Configuration parameters are:
- PacketSize_
- constant size of packets generated.
- burst_time_
- average on time for generator.
- idle_time_
- average off time for generator.
- rate_
- sending rate during on time.
- Application/Traffic/Pareto
- Application/Traffic/Pareto objects generate On/Off traffic with burst
times and idle times taken from pareto distributions. Configuration
parameters are:
- PacketSize_
- constant size of packets generated.
- burst_time_
- average on time for generator.
- idle_time_
- average off time for generator.
- rate_
- sending rate during on time.
- shape_
- the shape parameter used by pareto distribution.
- Application/Traffic/CBR
- CBR objects generate packets at a constant bit rate.
$cbr start
Causes the source to start generating packets.
$cbr stop
Causes the source to stop generating packets.
Configuration parameters are:
- PacketSize_
- constant size of packets generated.
- rate_
- sending rate.
- interval_
- (optional) interval between packets.
- random_
- whether or not to introduce random noise in the scheduled
departure times. defualt is off.
- maxpkts_
- maximum number of packets to send.
- Application/Traffic/Trace
- Application/Traffic/Trace objects are used to generate traffic from a
trace file.
$trace attach-tracefile tfile
Attach the Tracefile object tfile to this trace. The Tracefile object
specifies the trace file from which the traffic data is to be read.
Multiple Application/Traffic/Trace objects can be attached
to the same Tracefile object. A random starting place within the Tracefile
is chosen for each Application/Traffic/Trace object.
There are no configuration parameters for this object.
TRACEFILE OBJECTS
Tracefile objects are used to specify the trace file that is to be used
for generating traffic (see Application/Traffic/Trace objects
described earlier in this section). $tracefile is an instance of
the Tracefile Object.
$tracefile filename trace-input
Set the filename from which the traffic trace data is to be read to
trace-input.
There are no configuration parameters for this object. A trace file
consists of any number of fixed length records. Each record consists of 2
32 bit fields. The first indicates the interval until the next packet is
generated in microseconds. The second indicates the length of the next
packet in bytes.
A simple tcl file (tg.tcl)
to demonstrate different traffic sources is provided.
Some trace files:
Star Wars