The following is a list of error-model related commands commonly used in simulation scripts:
set em [new ErrorModel] $em unit pkt $em set rate_ 0.02 $em ranvar [new RandomVariable/Uniform] $em drop-target [new Agent/Null]
This is a simple example of how to create and configure an error model. The commands to place the error-model in a simple link will be shown next.
$ns_ lossmodel em src dst
This command places the error-model before the queue in a simplelink defined
by the <src> and <dst> nodes. This is basically a wrapper for the above method.
$simplelink insert-linkloss args
This inserts a loss-module after the queue, but right before the delay link_
element in the simple link. This is because nam can visualize a packet drop
only if the packet is on the link or in the queue. The error-module's
drop-target points to the link's drophead_ element.
$ns_ link-lossmodel em src dst
This too is a wrapper method for insert-linkloss method described above.
That is this inserts the error-module right after the queue element in a
simple link (src-dst).
In addition to the methods described above for the class ErrorModel, there are several other types of error modules derived from this base class like SRMErrorModel, ErrorModel/Trace, ErrorModel/Periodic etc. These definitions can be found in /tcl/lib/(ns-errmodel.tcl and ns-default.tcl).