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;
        }
    }
}
Tom Henderson 2011-11-05