next up previous contents index
Next: 17.2 Comparison of new Up: 17.1 New Node API Previous: 17.1.1 Node configuration

   
17.1.2 Node Creation

Once the node of the given type has been configured as shown in the previous subsectionsubsectionsec:nodeconfig, the next step is to create the nodes. The node-creation API basically looks very similar to the old node creation API. Incase of hierarchical addressing the node address has to be passed as an argument as shown below:

        set node [$ns_ node] 
## or
        set node [$ns_ node $node_address]  ;# incase of hierarchical
                                            ;# addressing.

Thus after having configured for AODV mobilenodes as shown in the example in the previous subsectionsubsectionsec:nodeconfig, we create "n=4" AODV mobilenodes as follows:

        set temp {1.0.0 1.0.1 1.0.2 1.0.3}   ;# list of node addresses
        for {set i 0} {$i \< $n) } {incr i} {
                set node_($i) [$ns_ node [lindex $temp $i]]
                $node_($i) random-motion 0       ;# disable random motion
        }

Thus 4 mobilenodes are created in cluster 0 of domain 1 (1.0.*) .




2000-08-24