Changes between Initial Version and Version 1 of Tutorials/k0SDR/Tutorial06


Ignore:
Timestamp:
Oct 10, 2014, 3:41:51 PM (10 years ago)
Author:
stojadin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials/k0SDR/Tutorial06

    v1 v1  
     1== Simple radio example with GNURADIO benchmark scripts ==
     2
     3[[TOC(Tutorials/k0SDR*)]]
     4
     5=== Description ===
     6This example will utilize an OEDL experiment script to execute packet transfers over a radio link created using GNU Radio. This is will involve running a GNU Radio benchmark script two nodes each with a USRP2.
     7
     8=== Hardware / Software Resources utilized ===
     9 1. Grid nodes with a USRP2 connect via Ethernet.
     10 2. ''baseline-12-04-gnu.ndz'': disk image loaded onto nodes. This image has all the precompiled - software required to configure the USRP2s and all the required GNU Radio software libraries. The USRP2's interface with the node is already configured.
     11 3. GNU Radio - software library to create SDR. Click here for [http://gnuradio.org/redmine/projects/gnuradio/wiki/WhatIsGR additional info].
     12 4. USRP2 - hardware platform for SDR. Click here for [http://gnuradio.org/redmine/projects/gnuradio/wiki/Hardware#Ettus-Research-USRP-Devices more info].
     13
     14=== Set up ===
     15 * To get started first make a reservation on the [https://www.orbit-lab.org/cPanel/controlPanel/start Orbit Scheduler] for using the Grid.
     16
     17 * After logging into grid console, make sure all nodes are turned off
     18{{{
     19nilanjan@console.grid:~$ omf tell -a offh -t system:topo:all
     20}}}
     21
     22 * Verify state of node before continuing. Make sure all nodes are in the POWEROFF state.
     23{{{
     24nilanjan@console.grid:~$ omf stat
     25}}}
     26
     27 * Image nodes. Two (2) are required to run - check [https://www.orbit-lab.org/cPanel/controlPanel/start inventory status] to find nodes with 2 similar USRP2s. In this examples we'll use node1-1 and node1-2.
     28{{{
     29nilanjan@console.grid:~$ omf load -i baseline-12-04-gnu.ndz -t node1-1,node1-2
     30}}}
     31
     32 * Turn nodes back on and verify they are in POWERON state
     33{{{
     34nilanjan@console.grid:~$ omf tell -a on -t system:topo:imaged
     35}}}
     36
     37=== Running OEDL script and viewing results ===
     38 * Run the experiment script using the following OMF command. The output is show as well.
     39{{{
     40nilanjan@console.grid:~$ omf exec system:exp:gnu-benchmark
     41
     42 INFO NodeHandler: OMF Experiment Controller 5.4 (git 3fb37b9)
     43 INFO NodeHandler: Reading configuration file /etc/omf-expctl-5.4/services.yaml
     44 INFO NodeHandler: Add domain http - http://internal1.orbit-lab.org:5054/
     45 INFO NodeHandler: Add domain http - http://repository1.orbit-lab.org:5054/
     46 INFO NodeHandler: Slice ID: default_slice (default)
     47 INFO NodeHandler: Experiment ID: default_slice-2014-07-17t14.20.09.457-04.00
     48 INFO NodeHandler: Message authentication is disabled
     49 INFO Experiment: load system:exp:stdlib
     50 INFO property.resetDelay: resetDelay = 230 (Fixnum)
     51 INFO property.resetTries: resetTries = 1 (Fixnum)
     52 INFO Experiment: load system:exp:eventlib
     53 INFO Experiment: load system:exp:winlib
     54 INFO Experiment: load system:exp:gnu-benchmark
     55 INFO property.rate: rate = ".250M" (String)
     56 INFO property.modulation: modulation = "bpsk" (String)
     57 INFO property.freq: freq = "2410000000" (String)
     58 INFO property.runtime: runtime = 10 (Fixnum)
     59 INFO Topology: Loaded topology '/tmp/pxe_slice-2014-07-17t13.52.30.457-04.00-topo-success'.
     60 INFO Topology: Loaded topology 'system:topo:imaged'.
     61TX: node1-2.grid.orbit-lab.org
     62RX: node1-1.grid.orbit-lab.org
     63 INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks.
     64 INFO exp: Request from Experiment Script: Wait for 2s....
     65 INFO exp: Start receiver app
     66 INFO exp: Request from Experiment Script: Wait for 2s....
     67 INFO exp: Start sending packets
     68 INFO exp: Request from Experiment Script: Wait for 10s....
     69 INFO exp: Stop transmitter and receiver
     70 INFO exp: Request from Experiment Script: Wait for 2s....
     71 INFO exp: done
     72 INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks.
     73 INFO NodeHandler:
     74 INFO NodeHandler: Shutting down experiment, please wait...
     75 INFO NodeHandler:
     76 INFO run: Experiment default_slice-2014-07-17t14.20.09.457-04.00 finished after 0:25
     77
     78nilanjan@console.grid:~$
     79}}}
     80
     81* Results from running the OEDL experiment can be found in a log file in /tmp directory. The name of the log file is the ''default_slice'' name found from the OEDL output appended with .log. A successful run will have several lines similar to the following. This is will show the packet number, number of packets received and the number of correctly formed packets as seen from the receiver.
     82{{{
     83:
     84:
     852014-07-21 10:51:07 DEBUG nodeHandler::AgentCommands: APP_EVENT STDOUT from: 'test:app:benchmark_rx#1' (node1-1.grid.orbit-lab.org) - msg: 'ok =  True  pktno =  140  n_rcvd =  140  n_right =  140'
     862014-07-21 10:51:07 DEBUG nodeHandler::AgentCommands: APP_EVENT STDOUT from: 'test:app:benchmark_rx#1' (node1-1.grid.orbit-lab.org) - msg: 'ok =  True  pktno =  141  n_rcvd =  141  n_right =  141'
     872014-07-21 10:51:07 DEBUG nodeHandler::AgentCommands: APP_EVENT STDOUT from: 'test:app:benchmark_rx#1' (node1-1.grid.orbit-lab.org) - msg: 'ok =  True  pktno =  142  n_rcvd =  142  n_right =  142'
     88:
     89:
     90}}}
     91
     92 The output from the transmitter will up as a series of periods '.' similar to the following:
     93{{{
     942014-07-21 10:51:09 DEBUG nodeHandler::AgentCommands: APP_EVENT STDERR from: 'test:app:benchmark_tx#1' (node1-2.grid.orbit-lab.org) - msg: '.................................................................U............................................................................................................................................................................................................................'
     95}}}
     96
     97
     98=== OEDL script ===
     99
     100{{{
     101defProperty('rate', '.250M', "Bitrate")
     102defProperty('modulation','bpsk',"Modulation")
     103defProperty('freq', '2410000000', "Center frequency")
     104defProperty('runtime', 10, "Run time (s)")
     105
     106
     107defApplication('test:app:benchmark_rx', 'benchmark_rx.py') { |a|
     108  a.version(2, 0, 4)
     109  a.shortDescription = ""
     110  a.description = ""
     111  a.path = "export LC_ALL=C;/root/gnuradio/gr-digital/examples/narrowband/benchmark_rx.py"
     112  a.defProperty('args', "Argument list", nil,
     113                {:dynamic => false, :type => :string})
     114  a.defProperty('freq', "center frequency in Hz", '-f',
     115                {:dynamic => false, :type => :string})
     116  a.defProperty('rx-gain', "receive gain in dB", '--rx-gain',
     117                {:dynamic => false, :type => :string})
     118  a.defProperty('bitrate', "specify bitrate", '-r',
     119                {:dynamic => false, :type => :string})
     120  a.defProperty('modulation', "modulation: psk, cpm, qpsk, dqpsk, gfsk,qam, dbpsk, bpsk, gmsk [default=psk]", '-m',
     121                {:dynamic => false, :type => :string})
     122  a.defProperty('constellation-points', "set constellation - power of two for psk, power of 4 for QAM [default=16]", '-p',
     123                {:dynamic => false, :type => :string})
     124}
     125
     126defApplication('test:app:benchmark_tx', 'benchmark_tx.py') { |a|
     127  a.version(2, 0, 4)
     128  a.shortDescription = ""
     129  a.description = ""
     130  a.path = "export LC_ALL=C;/root/gnuradio/gr-digital/examples/narrowband/benchmark_tx.py"
     131  a.defProperty('args', "Argument list", nil,
     132                {:dynamic => false, :type => :string})
     133  a.defProperty('freq', "center frequency in Hz", '-f',
     134                {:dynamic => false, :type => :string})
     135  a.defProperty('tx-gain', "transmit gain in dB", '--tx-gain',
     136                {:dynamic => false, :type => :string})
     137  a.defProperty('tx-amplitude', "transmitter digital amplitude [0,1)  [default=0.25", '--tx-amplitude',
     138                {:dynamic => false, :type => :string})
     139  a.defProperty('bitrate', "specify bitrate", '-r',
     140                {:dynamic => false, :type => :string})
     141  a.defProperty('modulation', "modulation: psk, cpm, qpsk, dqpsk, gfsk,qam, dbpsk, bpsk, gmsk [default=psk]", '-m',
     142                {:dynamic => false, :type => :string})
     143  a.defProperty('constellation-points', "set constellation - power of two for psk, power of 4 for QAM [default=16]", '-p',
     144                {:dynamic => false, :type => :string})
     145}
     146
     147
     148
     149defTopology('txnode') { |t|
     150  # Load the topology of imaged nodes
     151  # These nodes are from most recent omf load command
     152  baseTopo = Topology['system:topo:imaged']
     153
     154  # Draw a random node from the pool of active ones
     155  aNode = baseTopo.getUniqueRandomNode
     156
     157  # Add this random node to this 'senderTopo' topology
     158  t.addNode(aNode)
     159  puts "TX: #{t.getNodeByIndex(0).to_s}"
     160}
     161
     162defTopology('rxnode') { |t|
     163  # Load the topology of imaged nodes
     164  # These nodes are from most recent omf load command
     165  baseTopo = Topology['system:topo:imaged']
     166
     167  # Draw a random node from the pool of active ones
     168  aNode = baseTopo.getUniqueRandomNode
     169
     170  # Add this random node to this 'senderTopo' topology
     171  t.addNode(aNode)
     172  puts "RX: #{t.getNodeByIndex(0).to_s}"
     173}
     174
     175defGroup('rx', 'rxnode') { |n|
     176 n.addApplication('test:app:benchmark_rx') { |app|
     177   app.setProperty('freq', property.freq)
     178   app.setProperty('modulation',property.modulation)
     179   app.setProperty('bitrate',property.rate)
     180   app.setProperty('rx-gain','30')
     181 }
     182
     183}
     184
     185defGroup('tx', 'txnode') { |n|
     186 n.addApplication('test:app:benchmark_tx') { |app|
     187   app.setProperty('freq', property.freq)
     188   app.setProperty('modulation',property.modulation)
     189   app.setProperty('bitrate',property.rate)
     190   app.setProperty('tx-gain','30')
     191   app.setProperty('tx-amplitude','0.5')
     192 }
     193
     194}
     195
     196onEvent(:ALL_UP_AND_INSTALLED) { |event|
     197  # Wait a couple of seconds before proceeding so processes can settle down
     198  wait 2
     199
     200  # Start receiver application
     201  info "Start receiver app"
     202  group("rx").startApplications
     203
     204  # Wait a couple of seconds for receiver application to become ready
     205  wait 2
     206
     207  # Start transmitter application
     208  info "Start sending packets"
     209  group("tx").startApplications
     210
     211  # Run for specified runtime
     212  wait property.runtime
     213
     214  # Stop benchmark applications
     215  info "Stop transmitter and receiver"
     216  allGroups.stopApplications
     217
     218  # As a precaution manually kill the benchmark applications on tx & rx node
     219  allGroups.exec("PID=$(ps -ef | awk '$8==\"python\" {print $2}') ; kill -9 $PID")
     220  wait 2
     221
     222  info "done"
     223  Experiment.done
     224}
     225}}}