Tutorials/k0SDR/Tutorial05: uhd_exp1.rb.txt

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