Changes between Version 4 and Version 5 of Tutorials/k0SDR/Tutorial05


Ignore:
Timestamp:
May 20, 2013, 6:00:01 PM (12 years ago)
Author:
nilanjan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/k0SDR/Tutorial05

    v4 v5  
    55
    66== Hardware / Software Resourcesutilized ==
    7  1. 4 grid nodes with a USRP2 connect via Ethernet.
     7 1. 3 grid nodes with a USRP2 connect via Ethernet.
    88 2. ''ubuntu-12-04-uhd-daemon.ndz'': node image with all the precompiled software required to configure the USRPs.
    99 3. ''uhd_exp1.rb'' - OEDL script executed on the console. This script configures the USRPs for data collection at specified frequencies, sampling rate, etc...
     
    1313 * To get started first make a reservation on the [https://www.orbit-lab.org/schedule/ Orbit Scheduler].
    1414
    15  * Let's pick 4 nodes with a USRP2. For a current list of nodes with USRPs, goto the [https://www.orbit-lab.org/schedule/ Orbit Scheduler], click on ''Status Page'' under ''Quick Links''. Select the ''Grid'' Tab and filter by ''SDR'' and USRP_N210 or SBX. This will give a topology list of nodes (below) that can be used with the OMF commands:
     15 * Let's pick 3 nodes with a USRP2. For a current list of nodes with USRPs, goto the [https://www.orbit-lab.org/schedule/ Orbit Scheduler], click on ''Status Page'' under ''Quick Links''. Select the ''Grid'' Tab and filter by ''SDR'' and USRP_N210 or SBX. This will give a topology list of nodes (below) that can be used with the OMF commands:
    1616{{{
    1717[node1-1.grid.orbit-lab.org,node1-2.grid.orbit-lab.org,node1-19.grid.orbit-lab.org,node1-20.grid.orbit-lab.org,
     
    4646}}}
    4747
    48  * Download the OEDL experiment script [http://www.orbit-lab.org/raw-attachment/wiki/Tutorials/GNURadio/OmfExperiment1/uhd_exp1.rb uhd_exp1.rb] to your local directory on the console. Executing this script will tell the USRP2 record spectrum data for a few seconds at different carrier frequencies.
     48 * Download the OEDL experiment script [http://www.orbit-lab.org/raw-attachment/wiki/Tutorials/GNURadio/OmfExperiment1/uhd_exp1.rb uhd_exp1.rb] to your local directory on the console. Executing this script will command one USRP2 to transmit a carrier frequency at random frequency offsets while commanding the others to continually take FFT snapshots and record the measurements to an database file.
    4949   The contents of the uhd file is shown with additional comments:
    5050{{{
    5151nilanjan@console.grid:~/UHD$ cat uhd_exp1.rb
    52 defProperty('rxfreq',  2400e6, "Starting rx frequency")
    53 defProperty('rxstep',  10e6, "Rx frequency increments")
    54 defProperty('nfreq',   10, "Number of frequency steps")
    55 defProperty('dwell',   10, "Number of seconds at each frequency step")
     52defProperty('freq',  1500e6, "Starting rx frequency")
     53defProperty('dwell', 3, "Number of seconds at each frequency step")
     54
     55defGroup('txnode', 'node2-2.grid.orbit-lab.org') { |n|
     56}
     57
     58defGroup('rxnode', 'node1-1.grid.orbit-lab.org,node20-20.grid.orbit-lab.org') { |n|
     59}
     60
     61onEvent(:ALL_UP) do |event|
     62  info "Give machines some time to warm up"
     63  wait 4
     64
     65  info "activate"
     66  allGroups.uhd.u0.activate                         # starts UHD daemon
     67  wait 3
     68
     69  info "set tx parameters"
     70  group("txnode").uhd.u0.txfreq = property.freq     # set tx frequency (Hz)
     71  group("txnode").uhd.u0.txrate = "8e6"             # set tx sampling rate
     72  group("txnode").uhd.u0.txgain = "30"              # set tx gain (dB)
     73  group("txnode").uhd.u0.txampl = "0.7"             # set tx wavform amplitude
     74  #group("txnode").uhd.u0.txwavefreq = "1e6"
     75  group("txnode").uhd.u0.txwavetype = "CONST"       # set type of waveform to transmit = {CONST, SINE, RAMP}
     76  group("txnode").uhd.u0.transmit                   # start transmitting
     77
     78  group("rxnode").uhd.u0.rxfreq = property.freq     # set rx frequency
     79  group("rxnode").uhd.u0.rxrate = "8e6"             # set rx sampling rate
     80  group("rxnode").uhd.u0.rxgain = "25"              # set rx gain
     81  group("rxnode").uhd.u0.numbins = "128"            # number of fft points
     82  group("rxnode").uhd.u0.avgwinlen = "32"           # set averaging window size for each fft bin across time.
     83  group("rxnode").uhd.u0.omlfile = "spectrum.grid"  # oml database file name to store fft data
     84  group("rxnode").uhd.u0.omlserver = "idb2:3003"    # oml server
     85  group("rxnode").uhd.u0.record                     # start recording
     86
     87  (0..30).each { |i|                                # set up loop   
     88    offset = (rand()*4).to_f                        # find next transmit frequency
     89    cf = property.freq + (offset*1e6)
     90    group("txnode").uhd.u0.txfreq = cf              # set new transmit frequency
     91    wait property.dwell                             # wait for a few seconds
     92  }
    5693
    5794
    58 defGroup('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')
    59 { |n|
    60 }
     95  allGroups.uhd.u0.stop                             # stop transmitting and stop recording
     96  allGroups.uhd.u0.deactivate                       # stop UHD daemon
    6197
    62 
    63 onEvent(:ALL_UP) do |event|
    64   info "Give machines some time to warm up"
    65   wait 4
    66 
    67   allGroups.uhd.u0.activate                        # starts uhd_daemon
    68   wait 3
    69 
    70   group("rxnode").uhd.u0.rxrate = "8e6"            # set receive chain sampling rate
    71   group("rxnode").uhd.u0.rxgain = "20"             # set receive chain gain (dB)
    72   group("rxnode").uhd.u0.numbins = "128"           # set size of fft
    73   group("rxnode").uhd.u0.avgwinlen = "32"          # set averaging window size for each fft bin across time. 
    74 
    75   group("rxnode").uhd.u0.omlfile = "spectrum.grid" # oml database file name to store fft data
    76   group("rxnode").uhd.u0.omlserver = "idb2:3003"   # oml server
    77 
    78   group("rxnode").uhd.u0.record                    # start recording thread
    79 
    80   (0..property.nfreq).each { |i|                   # set up loop
    81     cf = property.rxfreq + (property.rxstep*i)     # compute next carrier frequency
    82     group("rxnode").uhd.u0.rxfreq = cf             # set receive chain carrier frequency (Hz)
    83 
    84     wait property.dwell                            # wait for number of seconds before computing next frequency
    85   }
    86 
    87   group("rxnode").uhd.u0.stop                      # stop recording thread
    88 
    89   allGroups.uhd.u0.deactivate                      # stop uhd_daemon
    90 
    91 
    92   info "Finish it."
     98  info "Finish it."
    9399  Experiment.done
    94100end
     
    115121{{{
    116122nilanjan@idb2:/var/lib/oml2$ sqlite3 spectrum.grid.sq3 ".dump"
    117 }}}
     123PRAGMA foreign_keys=OFF;
     124BEGIN TRANSACTION;
     125CREATE TABLE _senders (name TEXT PRIMARY KEY, id INTEGER UNIQUE);
     126INSERT INTO "_senders" VALUES('node20-20',1);
     127INSERT INTO "_senders" VALUES('node1-1',2);
     128CREATE TABLE _experiment_metadata (key TEXT PRIMARY KEY, value TEXT);
     129INSERT INTO "_experiment_metadata" VALUES('start_time','1369071050');
     130CREATE TABLE "spectrum_data" (oml_sender_id INTEGER, oml_seq INTEGER, oml_ts_client REAL, oml_ts_server REAL, "samplin
     131g" INTEGER, "cfreq_MHz" REAL, "gain_dB" INTEGER, "FFTLength" INTEGER, "FFTNum" TEXT, "FFTBins" BLOB);
     132INSERT INTO "spectrum_data" VALUES(1,1,0.534819999709725,211.009485,7692307,1500000000.0,25,128,'---',X'84B7C43E2146863DC912F53CC851933CF23EA93CCEC6AC3CEFF5EE3C7578D83CE054723C8C1D873C9F57F73C72CD1F3DF7C1BD3C7D75CC3CD972FA3C1A5B053DB973133DA6541E3D5ED0563DD8F0563DFA9E4B3D256B883DF368B03D02F2B43D77C1F53D403B2F3E2654A23E021EE33F690FFB3E7C7A613E7F6B093E49EFC93DA880AA3D78298B3DC5E1663D98FC483DCECC203D7755253D2BD7FE3CA74AEB3C5C8AF03C8453EE3C5F05D73CD289B63C4F51BD3C71A3BE3C5927983C2E6B8E3C6EFE753C19A3853CADAF7E3CBD118D3CFE1A963C99776F3CCC9E7F3CB610853CFE5A593C10E36B3C7365733C5EAC503CFA39353CA4CA763CC498213C44A11A3C07F1243CAEE5473CA26A483C6C603D3CFE6A483C6A9C113C9DCD0C3C1481413C3274C63B8B6A3F3C2701E33B506B6F3C3C9DDC3B05131B3CC50E1B3CB49D723C446E023C224B713C6E0FF33BFE68FD3B63FC0E3C3E33C43B9F8B973CB3A6733A992C813C76474E3C2DA1FC3A6DA70A3CCC66103CAA0A013C14874C3C24C4913AA335383C8472993CAA53BD3BEA0CA43B0846CB3CEBAF3B3CC2F1463C1AC0963CDD26553BF2C79C3A040E983CF4C8713C16F0AC3CF198233C98AA3B3C4E6D8D3C7CFEA13C7193723C317DFF3BA24DF93B17851D3CB140BE3C76979C3C31F39A3C41D05A3B56C5873C6D537F3C1540963CACF4F13CFB52DE3C6630093D5304343D');
     133}}}
    118134
    119  * The magnitude value of the fft bins are stored in binary format. The first entry of the db file is shown below. So when dumping the file contents the ftt bins data is shown as consecutive ascii representation of the binary floating point numbers.
     135 * The magnitude value of the fft bins are stored in binary format. The first entry of the db file is shown above. So when dumping the file contents the fft bins data is shown as consecutive ASCII representation of the binary floating point numbers. The 1st is 84B7C43E <==> 0.38421, the 2nd bin is 2146863D <==> 0.065563, etc...
    120136
     137 * To quickly visualize the data we can download and compile the following code.
     138{{{
    121139
    122  * 5/15/2013 - Work in progress...
     140}}}