Internal/Presentation/GENIMar09: vehicle-experiment-v1.rb

File vehicle-experiment-v1.rb, 1.9 KB (added by thierry, 15 years ago)
Line 
1#
2# A) Define the 'sender' group, which has the unique node [1,1]
3# Nodes in this group will execute the application 'test:proto:sender'
4#
5defGroup('source', [1,1]) {|node|
6 node.prototype("test:proto:udp_sender", {
7 'destinationHost' => '192.168.0.2',
8 'localHost' => '192.168.0.1',
9 'packetSize' => 128, # in Byte
10 'rate' => 4096 # in bits per second
11 })
12 # NOTE: a packet of 128 Bytes at a rate of 4096 bits/s = 4 pkt/sec
13}
14
15#
16# B) Define the 'receiver' group, which has the unique node [1,2]
17# Nodes in this group will execute the application 'test:proto:receiver'
18#
19defGroup('sink', [1,2]) {|node|
20 node.prototype("test:proto:udp_receiver" , {
21 'localHost' => '192.168.0.2'
22 })
23}
24
25#
26# C) Turn ON Disconnection Mode for all the groups in this experiment
27#
28allGroups.allowDisconnection
29
30#
31# D) Configure the wireless interfaces of All the Nodes involved in
32# this experiment
33#
34allGroups.net.w0 { |w|
35 w.mode = "adhoc"
36 w.type = 'g'
37 w.channel = "6"
38 w.essid = "vehicledemo"
39 w.ip = "%192.168.0.%y" # the '%' triggers some substitutions
40}
41
42#
43# E) When all the nodes are turned ON and all the applications
44# are installed and ready, we can start to perform the experiment
45#
46whenAllInstalled() {|node|
47
48 # Wait 30s to give time to wireless drivers to setup
49 wait 30
50
51 # Now start all the applications on all the groups
52 info "Experiment - Starting all Applications"
53 allGroups.startApplications
54
55 # Now wait for 10min (= 600sec) while the vehicle are moving around on the campus...
56 # NOTE: Please update that time to match full travel time of vehicle from base to base
57 wait 600
58
59 # Now stop all the applications on all the groups
60 info "Experiment - Stopping all Applications"
61 allGroups.stopApplications
62
63 # Wait an extra 30sec to let applications terminate nicely
64 wait 30
65
66 # Now terminate the Experiment
67 Experiment.done
68}