12.07.2015 Views

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 ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Delay <strong>and</strong> Loss Modules Each receiver in a group requires a delay module th<strong>at</strong> reflects its delay with respect to theparticular source. When the receiver joi<strong>ns</strong> a group, join-group{} identifies all session helpers in session_. If thedestin<strong>at</strong>ion index m<strong>at</strong>ches the group address the receiver are joining, then the following actio<strong>ns</strong> are performed.1. A new slot of the session helper is cre<strong>at</strong>ed <strong>and</strong> assigned to the receiver.2. <strong>The</strong> routine computes the accumul<strong>at</strong>ed b<strong>and</strong>width <strong>and</strong> delay between the source <strong>and</strong> receiver using the SessionSimi<strong>ns</strong>tance procedures get-bw{} <strong>and</strong> get-delay{}.3. A co<strong>ns</strong>tant r<strong>and</strong>om variable is cre<strong>at</strong>ed; it will gener<strong>at</strong>e r<strong>and</strong>om delivery times using the accumul<strong>at</strong>ive delay as anestim<strong>at</strong>e of the average delay.4. A new delay module is cre<strong>at</strong>ed with the end-to-end b<strong>and</strong>width characteristics, <strong>and</strong> the r<strong>and</strong>om variable gener<strong>at</strong>or providesthe delay estim<strong>at</strong>es.5. <strong>The</strong> delay module in i<strong>ns</strong>erted into the session helper <strong>and</strong> interposed between the helper <strong>and</strong> the receiver.See Section 42.1.2 for similarly i<strong>ns</strong>erting a loss module for a receiver.SessionSim i<strong>ns</strong>tproc join-group { agent group } {$self i<strong>ns</strong>tvar session_foreach index [array names session_] {set pair [split $index :]if {[lindex $pair 1] == $group} {# Note: must i<strong>ns</strong>ert the chain of loss, delay,# <strong>and</strong> destin<strong>at</strong>ion agent in this order:$session_($index) i<strong>ns</strong>ert $agentset src [lindex $pair 0]set dst [[$agent set node_] id]set accu_bw [$self get-bw $dst $src]set delay [$self get-delay $dst $src];# i<strong>ns</strong>ert destin<strong>at</strong>ion agent into session replic<strong>at</strong>or;# find accum. b/w <strong>and</strong> delayset r<strong>and</strong>om_variable [new R<strong>and</strong>omVariable/Co<strong>ns</strong>tant]$r<strong>and</strong>om_variable set avg_ $delayset delay_module [new DelayModel]$delay_module b<strong>and</strong>width $accu_bw$delay_module ranvar $r<strong>and</strong>om_variable;# set delay variable;# configure the delay module}}}$session_($index) i<strong>ns</strong>ert-module $delay_module $agent ;# i<strong>ns</strong>ert the delay module42.3.2 Packet ForwardingPacket forwarding activities are executed in C++. A source applic<strong>at</strong>ion gener<strong>at</strong>es a packet <strong>and</strong> forwards to its target whichmust be a replic<strong>at</strong>or (session helper). <strong>The</strong> replic<strong>at</strong>or copies the packet <strong>and</strong> forwards to targets in the active slots which areeither delay modules or loss modules. If loss modules, a decision is made whether to drop the packet. If yes, the packet is376

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

Saved successfully!

Ooh no, something went wrong!