OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 # |
| 4 # Copyright (c) 2017 Orange Labs |
| 5 # |
| 6 # This program is free software; you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 2 as |
| 8 # published by the Free Software Foundation; |
| 9 # |
| 10 # This program is distributed in the hope that it will be useful, |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 # GNU General Public License for more details. |
| 14 # |
| 15 # You should have received a copy of the GNU General Public License |
| 16 # along with this program; if not, write to the Free Software |
| 17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 # |
| 19 # Author: Rediet <getachew.redieteab@orange.com> |
| 20 # |
| 21 |
| 22 # This script runs wifi-trans-example for all combinations, plots transmitted sp
ectra |
| 23 # using the generated .plt file and puts result png images in wifi-trans-results
folder. |
| 24 # |
| 25 # Inspired from Tom's and Nicola's scripts for LAA-WiFi coexistence |
| 26 |
| 27 #Catch abort signal |
| 28 control_c() |
| 29 { |
| 30 echo "Aborted, exiting..." |
| 31 exit $? |
| 32 } |
| 33 trap control_c SIGINT |
| 34 |
| 35 #Save waf and script locations. Have to be run from where they are (otherwise wo
n't find executables) |
| 36 scriptDir=`pwd` |
| 37 cd ../../../ |
| 38 wafDir=`pwd` |
| 39 cd $scriptDir |
| 40 |
| 41 #Test where script is run from |
| 42 if test ! -f ${wafDir}/waf ; then |
| 43 echo "Please run this script from within the directory `dirname $0`, like this
:" |
| 44 echo "cd `dirname $0`" |
| 45 echo "./`basename $0`" |
| 46 exit 1 |
| 47 fi |
| 48 |
| 49 #Folder where PNGs should be grouped |
| 50 outputDir=`pwd`/wifi-trans-results |
| 51 if [ -d $outputDir ]; then |
| 52 echo "$outputDir directory exists." |
| 53 else |
| 54 mkdir -p "$outputDir" |
| 55 echo "$outputDir directory created." |
| 56 fi |
| 57 |
| 58 #List of available standards with corresponding bandwidth |
| 59 std_leg=("11a" "11_10MHZ" "11_5MHZ") |
| 60 std_n=("11n_2_4GHZ" "11n_5GHZ") |
| 61 std_ac_ax=("11ac" "11ax_2_4GHZ" "11ax_5GHZ") |
| 62 bw_leg=(20 10 5) |
| 63 bw_n=(20 40) |
| 64 bw_ac_ax=(20 40 80 160) |
| 65 |
| 66 #power spectrum density filename |
| 67 pre="spectrum-analyzer-wifi-" |
| 68 suf="-2-0" |
| 69 |
| 70 #Iteratively run simulation for all combinations |
| 71 #Legacy combinations |
| 72 for i in 0 1 2 |
| 73 do |
| 74 std=${std_leg[${i}]} |
| 75 bw=${bw_leg[${i}]} |
| 76 echo "===============================================" |
| 77 echo "Run for wifi-trans-example for ${std} and ${bw} MHz" |
| 78 cd $wafDir |
| 79 ./waf --run "wifi-trans-example --standard=$std --bw=$bw" |
| 80 echo "Generate PSD using ${file}.tr" |
| 81 file="${pre}${std}-${bw}MHz${suf}" |
| 82 gnuplot ${file}.plt |
| 83 if test ! -f ${file}.png ; then |
| 84 echo "PNG file (${file}.png) was not generated, something went wrong!" |
| 85 exit 1 |
| 86 else |
| 87 echo "PNG file (${file}.png) generated, remove .tr and .plt files" |
| 88 mv ${file}.png $outputDir |
| 89 rm -f ${file}.* |
| 90 echo "" |
| 91 fi |
| 92 done |
| 93 |
| 94 #11n combinations |
| 95 for std in "${std_n[@]}" |
| 96 do |
| 97 for bw in "${bw_n[@]}" |
| 98 do |
| 99 echo "===============================================" |
| 100 echo "Run for wifi-trans-example for ${std} and ${bw} MHz" |
| 101 cd $wafDir |
| 102 ./waf --run "wifi-trans-example --standard=$std --bw=$bw" |
| 103 echo "Generate PSD using ${file}.tr" |
| 104 file="${pre}${std}-${bw}MHz${suf}" |
| 105 gnuplot ${file}.plt |
| 106 if test ! -f ${file}.png ; then |
| 107 echo "PNG file (${file}.png) was not generated, something went wrong!" |
| 108 exit 1 |
| 109 else |
| 110 echo "PNG file (${file}.png) generated, remove .tr and .plt files" |
| 111 mv ${file}.png $outputDir |
| 112 rm -f ${file}.* |
| 113 echo "" |
| 114 fi |
| 115 done |
| 116 done |
| 117 |
| 118 #11ac/11ax combinations |
| 119 for std in "${std_ac_ax[@]}" |
| 120 do |
| 121 for bw in "${bw_ac_ax[@]}" |
| 122 do |
| 123 #160 MHz not available in 2.4 GHz |
| 124 [ ${std} = "11ax_2_4GHZ" ] && ([ ${bw} = "80" ] || [ ${bw} = "160" ]) && con
tinue |
| 125 #for all other combinations continue |
| 126 echo "===============================================" |
| 127 echo "Run for wifi-trans-example for ${std} and ${bw} MHz" |
| 128 cd $wafDir |
| 129 ./waf --run "wifi-trans-example --standard=$std --bw=$bw" |
| 130 echo "Generate PSD using ${file}.tr" |
| 131 file="${pre}${std}-${bw}MHz${suf}" |
| 132 gnuplot ${file}.plt |
| 133 if test ! -f ${file}.png ; then |
| 134 echo "PNG file (${file}.png) was not generated, something went wrong!" |
| 135 exit 1 |
| 136 else |
| 137 echo "PNG file (${file}.png) generated, remove .tr and .plt files" |
| 138 mv ${file}.png $outputDir |
| 139 rm -f ${file}.* |
| 140 echo "" |
| 141 fi |
| 142 done |
| 143 done |
| 144 |
| 145 echo "Finished" |
OLD | NEW |