experiment.rb

Thierry Rakotoarivelo, 01/09/2010 11:37 am

Download (1.2 kB)

 
1
defProperty('node', "omf.nicta.node29", "ID of a node")
2
defProperty('mode1', "adhoc", "wifi mode for 1st node")
3
defProperty('wifi', "g", "wifi type to use")
4
defProperty('channel', "1", "wifi channel to use")
5

    
6
defGroup('Observers', property.node) do |node|
7
  node.addApplication("wlanmonitor_app") do |app|
8
    app.setProperty('interface', 'ath0')
9
    app.setProperty('sampling', 3)
10
    app.measure('wlanstat')
11
  end
12
  node.net.w0.mode = property.mode1
13
  node.net.w0.type = property.wifi
14
  node.net.w0.channel = property.channel
15
  node.net.w0.essid = "expmonitor"
16
  node.net.w0.ip = "192.168.0.1"
17
end       
18

    
19
onEvent(:ALL_UP_AND_INSTALLED) do |event|
20
  wait 10
21
  allGroups.startApplications
22
  wait 300
23
  allGroups.stopApplications
24
  Experiment.done
25
end
26

    
27
addTab(:defaults)
28
addTab(:graph2) do |tab|
29
  opts = { :postfix => %{This graph shows the RSSI.}, :updateEvery => 3 }
30
  tab.addGraph("RSSI", opts) do |g|
31
    data = Hash.new
32
    mp = ms('wlanstat')
33
    mp.project(:oml_ts_server, :src_addr, :dst_addr, :rssi).each do |sample|
34
      time, src, dst, rssi = sample.tuple
35
      data[dst] = [] if data[dst] == nil
36
      data[dst] << [time, rssi] if src != dst
37
    end
38
    data.each do |d,v|
39
      g.addLine(v, :label => d)
40
    end
41
  end
42
end