diff --git a/examples/platform-specific/zoul/lt-wsn/plots/Energest.sh b/examples/platform-specific/zoul/lt-wsn/plots/Energest.sh index b19f3b6af41b237ebba07483b19db54a8fa84430..a851d6a26a6d47c1ba1b69736172fe4e734352af 100755 --- a/examples/platform-specific/zoul/lt-wsn/plots/Energest.sh +++ b/examples/platform-specific/zoul/lt-wsn/plots/Energest.sh @@ -10,17 +10,18 @@ nrg=0 C=$((600)) ecu=0 prc=0 +dating=$3 for v in $(grep "$1" $2 | cut -d ' ' -f13-53) do case $i in - [0-6]) + [0-5]) time=$(($time + ($v << ($i * 8)) ));; 8|9|1[0-1]) cpu=$(($cpu + ($v << (($i - 8) * 8)) ));; 1[6-9]) lpm=$(($lpm + ($v << (($i - 16) * 8)) ));; - 2[4-9]|3[0-1]) + 2[4-9]|3[01]) tx=$(($tx + ($v << (($i - 24) * 8)) ));; 3[2-9]) rx=$(($rx + ($v << (($i - 32) * 8)) ));; @@ -60,8 +61,13 @@ do prc=$(echo "$prc + $tps*100/$d" | bc -l) ecu=$(echo "100-$prc" | bc -l) - - echo $(date -d @$time +%D:%H:%M:%S) $ecu >> $$.nrg.tmp + + if [ $dating ] + then + echo $(date -d @$time +%D:%H:%M:%S) $ecu >> $$.nrg.tmp + else + echo $time $ecu >> $$.nrg.tmp + fi fi done cat $$.nrg.tmp diff --git a/examples/platform-specific/zoul/lt-wsn/plots/Rx.sh b/examples/platform-specific/zoul/lt-wsn/plots/Rx.sh index 21156b3507c94d8bc22496169f76643b8fa6374c..ba304f722447967c3eda5be7c0b5a0ac92973297 100755 --- a/examples/platform-specific/zoul/lt-wsn/plots/Rx.sh +++ b/examples/platform-specific/zoul/lt-wsn/plots/Rx.sh @@ -1,14 +1,15 @@ #!/bin/bash i=0 -tx=0 +rx=0 time=0 +dating=$3 for v in $(grep -E "$1" $2 | cut -d ' ' -f5-20) do case $i in [0-6]) - tx=$(($tx + ($v << ($i * 8)) )) + rx=$(($rx + ($v << ($i * 8)) )) ;; 8|9|1[0-5]) time=$(($time + ($v << (($i-8) * 8)) )) @@ -18,11 +19,16 @@ do i=$(((i+1)%16)) if [ $i -eq 0 ] then - if [ $tx -ne 0 ] - then - echo $(date -d @$time +%D:%H:%M:%S) $tx + if [ $rx -ne 0 ] + then + if [ $dating ] + then + echo $(date -d @$time +%D:%H:%M:%S) $rx + else + echo $time $rx + fi fi - tx=0 + rx=0 time=0 fi done diff --git a/examples/platform-specific/zoul/lt-wsn/plots/UipRpl.sh b/examples/platform-specific/zoul/lt-wsn/plots/UipRpl.sh index 683c50eebddc88fb0e57395792a6f4fc79cd5807..0c721c82162748413d2332c6b36c1fbdca270c3b 100755 --- a/examples/platform-specific/zoul/lt-wsn/plots/UipRpl.sh +++ b/examples/platform-specific/zoul/lt-wsn/plots/UipRpl.sh @@ -13,11 +13,13 @@ rcvip=0 fwip=0 dropip=0 +dating=$3 + for v in $(grep "$1" $2 | cut -d ' ' -f5-36) do case $i in [0-7]) - time=$(($time + ($v << ($i * 8)) )) + time=$(($time + ($v << ($i * 7)) )) ;; 8|9) senddio=$(($senddio + ($v << (($i-8) * 8)) )) @@ -60,7 +62,12 @@ do i=$(((i+1)%32)) if [ $i -eq 0 ] then - echo $(date -d @$time +%D:%H:%M:%S) $senddio $rcvdio $senddao $rcvdao $senddis $rcvdis $sendack $rcvack $sendip $rcvip $fwdip $dropip + if [ $dating ] + then + echo $(date -d @$time +%D:%H:%M:%S) $senddio $rcvdio $senddao $rcvdao $senddis $rcvdis $sendack $rcvack $sendip $rcvip $fwdip $dropip + else + echo $time $senddio $rcvdio $senddao $rcvdao $senddis $rcvdis $sendack $rcvack $sendip $rcvip $fwdip $dropip + fi time=0 senddio=0 diff --git a/examples/platform-specific/zoul/lt-wsn/plots/Volts.sh b/examples/platform-specific/zoul/lt-wsn/plots/Volts.sh index 7d238875b0e3ccd3a309bc83ac96a3eca41282c4..7c8506bdeb312ae1923945f845e45343b7797e06 100755 --- a/examples/platform-specific/zoul/lt-wsn/plots/Volts.sh +++ b/examples/platform-specific/zoul/lt-wsn/plots/Volts.sh @@ -3,6 +3,7 @@ i=0 time=0 volt=0 +dating=$3 rm $$.vlt.tmp &> /dev/null @@ -19,10 +20,15 @@ do i=$(((i+1)%12)) if [ $i -eq 0 ] then + if [ $dating ] + then if date -d @$time +%D:%H:%M:%S &>/dev/null - then - echo $(date -d @$time +%D:%H:%M:%S) $volt >> $$.vlt.tmp - fi + then + echo $(date -d @$time +%D:%H:%M:%S) $volt >> $$.vlt.tmp + fi + else + echo $time $volt >> $$.vlt.tmp + fi time=0 volt=0 fi diff --git a/examples/platform-specific/zoul/lt-wsn/plots/compute.sh b/examples/platform-specific/zoul/lt-wsn/plots/compute.sh index 5b206fd52f9f965765ae77a48dd0925bf6979551..0e3c382249f5ec68bbf2d7ddfc40732af2f95c34 100755 --- a/examples/platform-specific/zoul/lt-wsn/plots/compute.sh +++ b/examples/platform-specific/zoul/lt-wsn/plots/compute.sh @@ -1,30 +1,40 @@ #!/bin/bash i=0 -for a in $(cat sensors-adresses) + +dating=$2 + +for a in $(cat sensors-in-test) do if grep "^[0-9]* : $a " $1 > /dev/null then ### Rx Time grep "^[0-9]* : $a " $1 | cut -d ' ' -f1,4 | sort -uh > $a.rxt + ### Cycles timestamps echo "'^[0-9]* : [0-9]* ' $1 $a" | xargs ./Cycles.sh > $a.cyl + ## Network trace - echo "'^[0-9]* : $a (66|68|71|81) ' $1 " |xargs ./Rx.sh > $a.tx - i=$(($i+1)) + echo "'^[0-9]* : $a (66|68|71|81) ' $1 $dating " |xargs ./Rx.sh > $a.rx + ## All data contains volts info - echo "'^[0-9]* : $a 6[68]' $1" |xargs ./Volts.sh > $a.vlt + echo "'^[0-9]* : $a 6[68]' $1 $dating" |xargs ./Volts.sh > $a.vlt + ## Case for energest data - echo "'^[0-9]* : $a [78]1' $1" |xargs ./Energest.sh > $a.nrg + echo "'^[0-9]* : $a [78]1' $1 $dating" |xargs ./Energest.sh > $a.nrg + ## UIP and RPL stats - echo "'^[0-9]* : $a 83' $1" |xargs ./UipRpl.sh > $a.uip + echo "'^[0-9]* : $a 83' $1 $dating" |xargs ./UipRpl.sh > $a.uip + ## Analysis of each sensor + ## 2 0 : dht22 if grep -E "^[0-9]* : $a 6[68] ([0-9]+ ){20}2 0" $1 > /dev/null then echo "'^[0-9]* : $a 6[68]' $1" |xargs ./TempDht22.sh > $a.dht22 fi + ## 3 0 Analog light sensor - if grep -E "^[0-9]* : $a 6[68] ([0-9]+ ){12}3 0" $1 > /dev/null + if grep -E "^[0-9]* : $a 6[68] ([0-9]+ ){20}3 0" $1 > /dev/null then echo "'^[0-9]* : $a 6[68]' $1" |xargs ./LightA.sh > $a.lux fi @@ -81,7 +91,9 @@ then uipfiles=$(echo $uipfiles | sed s/' '/'"'' using 1:12','"'/g) uipfiles="\"$uipfiles\" using 1:12" uiprpl="$uiprpl, $uipfiles" - gnuplot <<EOF + if [ $dating ] + then + gnuplot <<EOF set terminal png size 1200,800 set output "uiprpl.png" set xdata time @@ -93,6 +105,17 @@ set ylabel "Number" set title "UIP and RPL stats" plot $uiprpl EOF + else + gnuplot <<EOF +set terminal png size 1200,800 +set output "uiprpl.png" +set grid +set xlabel "Temps" +set ylabel "Number" +set title "UIP and RPL stats" +plot $uiprpl +EOF + fi eog uiprpl.png fi @@ -120,8 +143,9 @@ if ls *.vlt &> /dev/null voltsfiles=$(ls *.vlt) voltsfiles=$(echo $voltsfiles | sed s/' '/'"'' using 1:2 with lines','"'/g) voltsfiles="\"$voltsfiles\" using 1:2 with lines" - - gnuplot <<EOF + if [ $dating ] + then + gnuplot <<EOF set terminal png size 1200,800 set output "volts.png" set xdata time @@ -133,17 +157,29 @@ set ylabel "Volts" set title "Voltage" plot $voltsfiles EOF + else + gnuplot <<EOF +set terminal png size 1200,800 +set output "volts.png" +set grid +set xlabel "Temps" +set ylabel "Volts" +set title "Voltage" +plot $voltsfiles +EOF + fi eog volts.png& fi -## Plotting Tx time -if ls *.tx &> /dev/null +## Plotting Rx time +if ls *.rx &> /dev/null then - txfiles=$(ls *.tx) + txfiles=$(ls *.rx) txfiles=$(echo $txfiles | sed s/' '/'"'' using 1:2','"'/g) txfiles="\"$txfiles\" using 1:2" - - gnuplot <<EOF + if [ $dating ] + then + gnuplot <<EOF set terminal png size 1200,800 set output "tx.png" set xdata time @@ -155,6 +191,17 @@ set ylabel "sec" set title "Temps accès réseau" plot $txfiles EOF + else + gnuplot <<EOF +set terminal png size 1200,800 +set output "tx.png" +set grid +set xlabel "Temps" +set ylabel "sec" +set title "Temps accès réseau" +plot $txfiles +EOF + fi eog tx.png& fi @@ -165,8 +212,9 @@ then nrgfiles=$(ls *.nrg) nrgfiles=$(echo $nrgfiles | sed s/' '/'"'' using 1:2 with lines','"'/g) nrgfiles="\"$nrgfiles\" using 1:2 with lines" - - gnuplot <<EOF + if [ $dating ] + then + gnuplot <<EOF set terminal png size 1200,800 set output "energy.png" set xdata time @@ -178,6 +226,17 @@ set ylabel "mA" set title "Energy" plot $nrgfiles EOF + else + gnuplot <<EOF +set terminal png size 1200,800 +set output "energy.png" +set grid +set xlabel "Temps" +set ylabel "mA" +set title "Energy" +plot $nrgfiles +EOF + fi eog energy.png& fi @@ -204,23 +263,42 @@ fi ## Plotting Temperature if ls *.dht22 &> /dev/null then - tempfiles=$(ls *.dht22) - tempfiles=$(echo $tempfiles | sed s/' '/'"'' using 1:2 with lines','"'/g) - tempfiles="\"$tempfiles\" using 1:2 with lines" + tmphmd="" + dhtfiles=$(ls *.dht22) + dhtfiles=$(echo $dhtfiles | sed s/' '/'"'' using 1:2 with lines','"'/g) + dhtfiles="\"$dhtfiles\" using 1:2 with lines" + tmphmd="$dhtfiles" + dhtfiles=$(ls *.dht22) + dhtfiles=$(echo $dhtfiles | sed s/' '/'"'' using 1:3 with lines','"'/g) + dhtfiles="\"$dhtfiles\" using 1:3 with lines" + tmphmd="$tmphmd, $dhtfiles" - gnuplot <<EOF + if [ $dating ] + then + gnuplot <<EOF set terminal png size 1200,800 -set output "temperatures.png" +set output "temp-hmd.png" set xdata time set timefmt "%m/%d/%y:%H:%M:%S" set format x "%m-%d\n%H:%M" set grid set xlabel "Temps" -set ylabel "Temp" -set title "Temperature" -plot $tempfiles +set ylabel "%" +set title "Temperature and humidity" +plot $tmphmd +EOF + else + gnuplot <<EOF +set terminal png size 1200,800 +set output "temp-hmd.png" +set grid +set xlabel "Temps" +set ylabel "%" +set title "Temperature and humidity" +plot $tmphmd EOF - eog temperatures.png& + fi + eog temp-hmd.png& fi ## Plotting light