Changes between Version 7 and Version 8 of Tutorials/a0Basic/Tutorial2
- Timestamp:
- Apr 13, 2006, 11:53:27 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tutorials/a0Basic/Tutorial2
v7 v8 66 66 The last line 'node.net.w0.mode' configures the first wireless interface ''w0'' to be used in ''managed'' mode. 67 67 68 The next block of code defines thereceiver in similar fashion. We are using the ''receiver'' prototype here which installs a traffic sink. In addition, we are setting the receiver's first wireless interface to ''master'' mode.68 The next block of code defines node1-2 as a receiver in similar fashion. We are using the ''receiver'' prototype here which installs a traffic sink. In addition, we are setting the receiver's first wireless interface to ''master'' mode. 69 69 70 70 {{{ … … 77 77 }}} 78 78 79 What follows is an example on how to configure interfaces on all nodes in one place to ensure consistency. The command ''allNodes.net.w0'' describes the first wireless interface on all nodes in the experiment. The code inside the curly braces configures various parameters of these interfaces. In this specific example we configure the interface as an 802.11b type, set the ''essid'' to a common string, and set it's IP address. We obviously do not want to set all the interfaces to the same IP address, but any string beginning with a '%' is ''personalized'' for each node by replacing characters preceeded by a '%' with a local string. In this specific example, '%y' is replaced by the 'y' coordinate of the node. For this specific experiment setup, the IP address of node1_1 will be 192.168.1.1, while node1_2 will have 192.168.1.2 assigned. 79 80 80 Configures the first wireless card on all nodes to 802.11b, essid ‘helloworld’ with ip81 addresses 192.168.x.y where x.y are the grid co-ordinates of the repsective nodes.82 81 {{{ 83 82 allNodes.net.w0 { |w| … … 87 86 } 88 87 }}} 89 Now, we start the application. This is like a barrier implementation where nodehandler waits to receive an OK message from each of 90 the nodeagents, and only proceeds when initial configurations are OK.88 89 This concludes the configuration steps and we will now describe the experiment itself. The experiment script basically defines a state machine, or more precisely, what sequence of commands should be executed if the experiments enters a particular state. The only state we will use in this experiment is ''whenAllInstalled'' which the experiment controller reaches when all nodes are configures and all requested applications are installed and ready to go. 91 90 {{{ 92 91 whenAllInstalled() {|node| 92 wait 30 93 94 allNodes.startApplications 95 wait 40 96 97 Experiment.done 98 } 93 99 }}} 94 This command will request nodeagents to launch the application corresponding 95 to the role that the node is playing, e.g sender will launch the application ''otg'' and 96 the receiver will launch the application ''otr'' with the command line options 97 as specified before 98 {{{ 99 allNodes.startApplications 100 }}} 101 Conduct experiment for 60 seconds 102 {{{ 103 wait 60 104 }}} 105 End of experiment – Shut down all nodes 106 {{{ 107 Experiment.done 108 }}} 100 The first command 'wait 30' will block for an additional 30 seconds to ensure that indeed everything has settled. The ''allNodes.startApplications'' will send a command to all nodes to start the applications defined in the above 'defNodes' block, or more precisly the used prototypes. In our experiment, this command will start a traffic generator in node1_2 and a corresponding sink in node1_2. The rate and packet size parameters for the traffic generator are taken from the above definition as well. 101 102 The next line 'wait 40' will instruct the experiment controller to wait for 40 seconds before concluding the experiment (''Experiment.done''). 103