Tutorials/Wireless/Measurement Tool: spectrum-demo.rb

File spectrum-demo.rb, 4.4 KB (added by nilanjan, 5 years ago)
Line 
1#
2# OEDL Script to call and execute rx_multi_receive application
3# for OTA sample collection.
4#
5#
6
7
8#
9# Section name: defProperty
10#
11# Description
12# defProperty is used to define experiment parameters that can be passed in from the command line.
13# If the parameter is not specified on the command line then a default value is assigned.
14#
15# Format
16# defProperty(parameter, default value, Text description)
17# - parameter is a variable that can be used through out the experiement
18# It is like a global in this script.
19# - default value is assigned to the above paramter if the paramter is not
20# specified in the command line.
21# - In this field add a text description for the paramter.
22#
23defProperty('duration_', 15, "Application runtime in seconds")
24defProperty('group', '--', "your MERIF group color")
25
26baseTopo = Topology['system:topo:group-' + property.group.to_s]
27
28
29#
30# Section name: defApplication
31#
32# Description
33# defApplication defines the application and all the input arguments
34# that we want to use in this experiment script.
35#
36# Format
37# defApplication(app_reference, application name)
38# - app_reference: symbolic name that can be used to reference
39# the application in other parts of the script
40#
41# Body contents (most important fields)
42#
43# a.path defines the complete pathname for the application.
44#
45# a.defProperty(var_reference, description, application input)
46# - var_reference: the script's symbolic name give to the application's command line argument
47# - description: is a description of the above command line arugment
48# - application input: command line arguments / flags
49#
50defApplication('ref_rx_receive', 'rx_multi_receive') { |a|
51 a.description = "UHD c++ application to read OTA samples from Software Defined Radio"
52 a.path = "export LC_ALL=C;/root/RX_MULTI_RECEIVE/rx_multi_receive"
53
54 a.defProperty('nsamps', 'Number of samples', '--nsamps')
55 a.defProperty('freq', 'Center frequency', '--freq')
56 a.defProperty('rate', 'Sample rate', '--rate')
57 a.defProperty('gain', 'RX path gain', '--gain')
58 a.defProperty('args', 'like this... addr0=10.10.23.5', '--args')
59 a.defProperty('subdev', 'sub device radio selection... A:0 B:0', '--subdev')
60 a.defProperty('channels', 'Channel list', '--channels')
61 a.defProperty('prefix', 'File out prefix', '--prefix')
62 a.defProperty('sync', 'sync', '--sync')
63 a.defProperty('secs', 'seconds into future', '--sec')
64
65# additional properties added for OML collection
66 a.defProperty('oml-id', 'sender id', '--oml-id')
67 a.defProperty('oml-domain', 'sq3 database file', '--oml-domain')
68 a.defProperty('oml-collect', 'storage location', '--oml-collect')
69}
70
71
72#
73# Section name: defGroup
74#
75# Description
76# defGroup defines the compute nodes that the above application will be running on.
77#
78# Format
79# defGroup(node_reference, group of compute nodes)
80# - node_reference: symbolic name to reference the group of nodes
81#
82# Body contents (most important fields)
83#
84# a.setProperty(var_reference, value)
85# - var_reference: the script's symbolic name give to the application's command line argument
86# - value: assigns a value to command line argument.
87#
88defGroup('rx_sdr', baseTopo.getNodeByIndex(0).to_s) do |node|
89 node.addApplication("ref_rx_receive") do |a|
90 a.setProperty('nsamps', "1024000") # Sticky note: no more than 3 zeros at the end
91 a.setProperty('freq', "2440e6")
92 a.setProperty('rate', "20e6")
93 a.setProperty('gain', "22")
94 a.setProperty('args', "addr0=192.168.10.2")
95 a.setProperty('subdev', "A:0")
96 a.setProperty('channels', "0")
97 #a.setProperty('prefix', "/root/RX_MULTI_RECEIVE/x310_")
98 a.setProperty('secs', "1.5")
99
100 a.setProperty('oml-id', baseTopo.getNodeByIndex(0).to_s)
101 a.setProperty('oml-domain', property.group.to_s)
102 #a.setProperty('oml-domain', "rx_multi_samples")
103 a.setProperty('oml-collect', "oml:3003")
104 end
105end
106
107info "Using SDR on node: " + baseTopo.getNodeByIndex(0).to_s
108
109onEvent(:ALL_UP_AND_INSTALLED) { |event|
110 info "Preparing OML experiment"
111 wait 1
112
113 info "Running the experiment"
114 group("rx_sdr").startApplications
115
116 wait property.duration_
117
118 #allGroups.exec("pkill rx_multi_receive")
119 #allGroups.stopApplications
120
121 info "Stopping the applications"
122 Experiment.done
123 exit
124}