Tutorials/k0SDR/Tutorial05: uhd_exp1.rb.txt

File uhd_exp1.rb.txt, 1.7 KB (added by nilanjan, 11 years ago)
Line 
1defProperty('rxfreq', 2400e6, "Starting rx frequency")
2defProperty('rxstep', 10e6, "Rx frequency increments")
3defProperty('nfreq', 10, "Number of frequency steps")
4defProperty('dwell', 10, "Number of seconds at each frequency step")
5
6
7defGroup('rxnode', 'node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org')
8
9{ |n|
10}
11
12
13onEvent(:ALL_UP) do |event|
14 info "Give machines some time to warm up"
15 wait 4
16
17
18 allGroups.uhd.u0.activate # starts uhd_daemon
19 wait 3
20
21 group("rxnode").uhd.u0.rxrate = "8e6" # set receive chain sampling rate
22 group("rxnode").uhd.u0.rxgain = "20" # set receive chain gain (dB)
23 group("rxnode").uhd.u0.numbins = "128" # set size of fft
24 group("rxnode").uhd.u0.avgwinlen = "32" # set averaging window size for each fft bin across time.
25
26 group("rxnode").uhd.u0.omlfile = "spectrum.grid" # oml database filename to store fft data
27 group("rxnode").uhd.u0.omlserver = "idb2:3003" # oml server
28
29 group("rxnode").uhd.u0.record # enable recording thread
30
31 (0..property.nfreq).each { |i| # set up loop
32 cf = property.rxfreq + (property.rxstep*i) # compute next carrier frequency
33 group("rxnode").uhd.u0.rxfreq = cf # set receive chain carrier frequency (Hz)
34
35 wait property.dwell # wait for number of seconds before computing next frequency
36 }
37
38 group("rxnode").uhd.u0.stop # stop recording thread
39
40 allGroups.uhd.u0.deactivate # turn off uhd_daemon
41
42
43 info "Finish it."
44 Experiment.done
45end