Tutorials/k0SDR/Tutorial23: bot_ofdm.rb

File bot_ofdm.rb, 2.7 KB (added by ratnesh, 7 months ago)
Line 
1defProperty('txnode', 'node21-1.grid.orbit-lab.org', "Console connected to the transmit node")
2#defProperty('addr', 'addr=10.10.23.3', "IP address of USRP")
3defProperty('rate', '5e6', "Sampling rate")
4#defProperty('freq', '5030000000', "Center frequency")
5defProperty('t_on', '5', "ON duration (number of slots)")
6defProperty('t_off', '7', "OFF duration (number of slots)")
7#defProperty('t_gran', '0.5', "Time granularity (in seconds)")
8defProperty('runtime', 50, "Run time (s)")
9
10defApplication('test:app:genericofdm', 'generic_ofdm.py') { |a|
11    a.version(2, 0, 4)
12    a.shortDescription = ""
13    a.description = ""
14    a.path = "export LC_ALL=C;/root/SC2/generic_ofdm.py"
15    a.defProperty('addr', "IP address of USRP", '--addr',
16                  {:dynamic => false, :type => :string})
17    a.defProperty('freq', "center frequency in Hz", '-f',
18                  {:dynamic => false, :type => :string})
19    a.defProperty('gain', "Transmit gain in dB", '--gain', 
20                  {:dynamic => false, :type => :string})
21    a.defProperty('rate', "specify sampling rate", '--rate',
22                  {:dynamic => false, :type => :string})
23    a.defProperty('t_gran', "specify size of time slot in seconds", '--t-gran',
24                  {:dynamic => false, :type => :string})
25    a.defProperty('t_on', "specify ON duration (number of slots)", '--t-on',
26                  {:dynamic => false, :type => :string})
27    a.defProperty('t_off', "specify OFF duration (number of slots)", '--t-off',
28                  {:dynamic => false, :type => :string})
29}
30
31defGroup('tx_node0', property.txnode) { |n|
32    n.addApplication('test:app:genericofdm') { |app|
33        app.setProperty('addr','addr=10.10.23.1')
34        app.setProperty('freq', '5040000000')
35        app.setProperty('rate',property.rate)
36        app.setProperty('gain','20')
37        app.setProperty('t_gran','0.4')
38        app.setProperty('t_on',property.t_on)
39        app.setProperty('t_off',property.t_off)
40    }
41}
42
43defGroup('tx_node1', property.txnode) { |n|
44    n.addApplication('test:app:genericofdm') { |app|
45        app.setProperty('addr','addr=10.10.23.2')
46        app.setProperty('freq', '5050000000')
47        app.setProperty('rate',property.rate)
48        app.setProperty('gain','20')
49        app.setProperty('t_gran','0.5')
50        app.setProperty('t_on',property.t_on)
51        app.setProperty('t_off',property.t_off)
52    }
53}
54
55onEvent(:ALL_UP_AND_INSTALLED) { |event|
56    info "Give machines some time to warm up :-)" 
57    wait 2
58    info "Starting the transmitter"
59    allGroups.startApplications
60    info "Runing for #{property.runtime} seconds..."
61    wait property.runtime
62    info "Done! Stop eveything"
63    allGroups.stopApplications
64    Experiment.done
65}
66