defProperty('resS', 'node055', "ID of sensing node") defProperty('res1', 'node050', "ID of server WiFi node") defProperty('res2', 'node051', "ID of client WiFi node") defProperty('duration', 10, "Duration of a part of the experiment") defProperty('channel', 2, "WiFi channel") defProperty('frequency', 2.417E9, "Sensing frequency") defProperty('user', 'nemilose', "Tutorial username") #WiFi nodes defGroup('Server', 'omf.nitos.'+property.res1) do |node| node.addApplication("iperf") do |app| app.setProperty('port', 5000) app.setProperty('server', true) app.setProperty('oml-server', 'tcp:nitlab3.inf.uth.gr:3003') end node.net.w0.mode = 'adhoc' node.net.w0.type = 'g' node.net.w0.channel = property.channel node.net.w0.essid = 'tutorial' +property.user node.net.w0.ip = '192.168.0.2' end defGroup('Client', 'omf.nitos.'+property.res2) do |node| node.addApplication("iperf") do |app| app.setProperty('port', 5000) app.setProperty('client', '192.168.0.2') app.setProperty('time', 20) app.setProperty('reportstyle', 'o') app.measure('transfer', :samples => 1) end node.net.w0.mode = 'adhoc' node.net.w0.type = 'g' node.net.w0.channel = property.channel node.net.w0.essid = 'tutorial' +property.user node.net.w0.ip = '192.168.0.3' end #USRP sensing node defGroup('Sensor', 'omf.nitos.'+property.resS) do |node| node.addApplication("wiserd-wrapper") do |app| app.setProperty('uhd_rx_rate', '2E6') #Sampling rate app.setProperty('uhd_rx_freq', (property.frequency).to_s) app.setProperty('uhd_rx_gain', '60') #Receiver gain in dB app.setProperty('recv_numbins', '256') #FFT size app.setProperty('recv_avgwinlen', '500') #Averaging window size for the results app.setProperty('recv_running_time', (property.duration*1000/10).to_s) #Duration of the spectrum sensing app.setProperty('timed', '') #Spectrum sensing duration is time limited app.setProperty('recv_oml_output_type', 'vector') #The output type for the results app.setProperty('recv_oml_servername', 'file:/root/file') #The results will be stored in file app.setProperty('fftmovingavgoml', '') #Spectrum sensing algorithm is executed end end onEvent(:ALL_UP_AND_INSTALLED) do |event| info "This is OMF-WiFi-USRP-wiserd experiment" wait 10 info "Removing any previous spectrum sensing results..." group("Sensor").exec("rm /root/file"); info "Starting Wiserd..." group("Sensor").startApplications wait property.duration*5 #We give wiserd time to execute, set up parameters and finish info "Stopping Wiserd..." group("Sensor").stopApplications #wiserd is closed wait property.duration*2 info "Starting WiFi..." group("Server").startApplications group("Client").startApplications info "Starting Wiserd..." group("Sensor").startApplications wait property.duration*2 #We give wiserd time to execute, set up parameters and finish info "Drawing spectrum" group("Sensor").exec("cd /root ; /usr/bin/octave /root/draw.m ; mv figure1.jpg "+property.user+".jpg") wait property.duration; info "Copying spectrum image" group("Sensor").exec("cd /root ; ./uploadfig.sh " + property.user + ".jpg" + " 160.99.9.162 tutorial tutorialpass") allGroups.stopApplications info "All my Applications are stopped now." Experiment.done end