Each receiver in a group requires a delay module that reflects its delay with respect to the particular source. When the receiver joins a group, []join-group identifies all session helpers in session_. If the destination index matches the group address the receiver are joining, then the following actions are performed.
SessionSim instproc join-group { agent group } {
\$self instvar session\_
foreach index [array names session\_] {
set pair [split \$index :]
if {[lindex \$pair 1] == \$group} {
# Note: must insert the chain of loss, delay,
# and destination agent in this order:
\$session\_(\$index) insert \$agent # insert destination agent into session replicator;
set src [lindex \$pair 0] # find accum. b/w and delay;
set dst [[\$agent set node\_] id]
set accu\_bw [\$self get-bw \$dst \$src]
set delay [\$self get-delay \$dst \$src]
set random\_variable [new RandomVariable/Constant] # set delay variable ;
\$random\_variable set avg\_ \$delay
set delay\_module [new DelayModel] # configure the delay module;
\$delay\_module bandwidth \$accu\_bw
\$delay\_module ranvar \$random\_variable
\$session\_(\$index) insert-module \$delay\_module \$agent # insert the delay module;
}
}
}