added daily stuff
authorstephen
Fri, 13 Jan 2017 13:10:05 +0000
changeset 4d00a4faad5f7
parent 3 f4210ad5011b
child 5 8bb841b98b16
added daily stuff
battery.log
checkup.sh
daily/loradtn-2017-01-11.gpl
daily/loradtn-2017-01-11.png
daily/loradtn-2017-01-12.gpl
daily/loradtn-2017-01-12.png
daily/loradtn-2017-01-13.gpl
daily/loradtn-2017-01-13.png
doit.sh
loradtn-20170111.png
loradtn-20170112.png
loradtn.gpl
loradtn.png
sedded-battery.log
     1.1 Binary file battery.log has changed
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/checkup.sh	Fri Jan 13 13:10:05 2017 +0000
     2.3 @@ -0,0 +1,12 @@
     2.4 +#!/bin/bash
     2.5 +
     2.6 +# set -x
     2.7 +
     2.8 +res=`ssh basil.dsg.cs.tcd.ie ping -c 1 tunloradtn | grep '1 received'`
     2.9 +
    2.10 +if [ "$res" == "" ]
    2.11 +then
    2.12 +	echo "down"
    2.13 +else
    2.14 +	echo "up"
    2.15 +fi
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/daily/loradtn-2017-01-11.gpl	Fri Jan 13 13:10:05 2017 +0000
     3.3 @@ -0,0 +1,60 @@
     3.4 +# set term postscript eps color solid blacktext "Helvetica" 14
     3.5 +# set output 'loradtn.eps'
     3.6 +# set size 4,4
     3.7 +
     3.8 +set terminal png nocrop enhanced size 1024,768
     3.9 +set output 'loradtn-2017-01-11.png'
    3.10 +
    3.11 +set datafile separator ","
    3.12 +set xdata time
    3.13 +set timefmt "%Y-%m-%d %H:%M:%S"
    3.14 +
    3.15 +os='2017-01-11 11:00:00'
    3.16 +oe='2017-01-11 16:00:00'
    3.17 +
    3.18 +set title "Loradtn power (Mech. Eng. roof)"
    3.19 +set key below 
    3.20 +
    3.21 +r1=1700
    3.22 +r2=1800
    3.23 +r3=1900
    3.24 +r4=2000
    3.25 +
    3.26 +nospike=0
    3.27 +spike=1
    3.28 +newdata=2
    3.29 +
    3.30 +set xrange [os:oe]
    3.31 +set yrange [1500:19000]
    3.32 +set y2range [-6000:8000]
    3.33 +
    3.34 +set ylabel "mV"
    3.35 +set y2label "mA"
    3.36 +set ytics nomirror
    3.37 +
    3.38 +set ytics (\
    3.39 +"OVERRIDE" 5000,\
    3.40 +"UP" 4500,\
    3.41 +"STBYSHORT" 4000,\
    3.42 +"STBYLONG" 3500,\
    3.43 +"SLEEP" 3000,\
    3.44 +"OFF" 2500,\
    3.45 +"14500" 14500,\
    3.46 +"14000" 14000,\
    3.47 +"13500" 13500,\
    3.48 +"13000" 13000,\
    3.49 +"12500" 12500,\
    3.50 +"12000" 12000,\
    3.51 +"11500" 11500,\
    3.52 +"11000" 11000,\
    3.53 +"spike" 10050)
    3.54 +
    3.55 +set y2tics ( 4000, 3500, 3000, 2500, 2000, 1500, 1000, 500, 0, -500, -1000, "spike" -2000 )
    3.56 +
    3.57 +
    3.58 +set pointsize 10
    3.59 +
    3.60 +plot 'sedded-battery.log' using 1: ( ($2 == r1 && $7 != newdata) ? ( ( ($7 == spike) ? 10050 : (10 * $4) ) ) : 1/0 ) axes x1y1 title "mV" with points ps 1, \
    3.61 +     'sedded-battery.log' using 1: ( ($2 == r1 && $7 != newdata) ? ( ( ($7 == spike) ?   -2000 :       $5  ) ) : 1/0 ) axes x1y2 title "mA" with points ps 1, \
    3.62 +     'sedded-battery.log' using 1: ( ($2 == r1) ? (2000 + $6) : 1/0 ) axes x1y1 title "state" with step
    3.63 +
     4.1 Binary file daily/loradtn-2017-01-11.png has changed
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/daily/loradtn-2017-01-12.gpl	Fri Jan 13 13:10:05 2017 +0000
     5.3 @@ -0,0 +1,60 @@
     5.4 +# set term postscript eps color solid blacktext "Helvetica" 14
     5.5 +# set output 'loradtn.eps'
     5.6 +# set size 4,4
     5.7 +
     5.8 +set terminal png nocrop enhanced size 1024,768
     5.9 +set output 'loradtn-2017-01-12.png'
    5.10 +
    5.11 +set datafile separator ","
    5.12 +set xdata time
    5.13 +set timefmt "%Y-%m-%d %H:%M:%S"
    5.14 +
    5.15 +os='2017-01-12 11:00:00'
    5.16 +oe='2017-01-12 16:00:00'
    5.17 +
    5.18 +set title "Loradtn power (Mech. Eng. roof)"
    5.19 +set key below 
    5.20 +
    5.21 +r1=1700
    5.22 +r2=1800
    5.23 +r3=1900
    5.24 +r4=2000
    5.25 +
    5.26 +nospike=0
    5.27 +spike=1
    5.28 +newdata=2
    5.29 +
    5.30 +set xrange [os:oe]
    5.31 +set yrange [1500:19000]
    5.32 +set y2range [-6000:8000]
    5.33 +
    5.34 +set ylabel "mV"
    5.35 +set y2label "mA"
    5.36 +set ytics nomirror
    5.37 +
    5.38 +set ytics (\
    5.39 +"OVERRIDE" 5000,\
    5.40 +"UP" 4500,\
    5.41 +"STBYSHORT" 4000,\
    5.42 +"STBYLONG" 3500,\
    5.43 +"SLEEP" 3000,\
    5.44 +"OFF" 2500,\
    5.45 +"14500" 14500,\
    5.46 +"14000" 14000,\
    5.47 +"13500" 13500,\
    5.48 +"13000" 13000,\
    5.49 +"12500" 12500,\
    5.50 +"12000" 12000,\
    5.51 +"11500" 11500,\
    5.52 +"11000" 11000,\
    5.53 +"spike" 10050)
    5.54 +
    5.55 +set y2tics ( 4000, 3500, 3000, 2500, 2000, 1500, 1000, 500, 0, -500, -1000, "spike" -2000 )
    5.56 +
    5.57 +
    5.58 +set pointsize 10
    5.59 +
    5.60 +plot 'sedded-battery.log' using 1: ( ($2 == r1 && $7 != newdata) ? ( ( ($7 == spike) ? 10050 : (10 * $4) ) ) : 1/0 ) axes x1y1 title "mV" with points ps 1, \
    5.61 +     'sedded-battery.log' using 1: ( ($2 == r1 && $7 != newdata) ? ( ( ($7 == spike) ?   -2000 :       $5  ) ) : 1/0 ) axes x1y2 title "mA" with points ps 1, \
    5.62 +     'sedded-battery.log' using 1: ( ($2 == r1) ? (2000 + $6) : 1/0 ) axes x1y1 title "state" with step
    5.63 +
     6.1 Binary file daily/loradtn-2017-01-12.png has changed
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/daily/loradtn-2017-01-13.gpl	Fri Jan 13 13:10:05 2017 +0000
     7.3 @@ -0,0 +1,60 @@
     7.4 +# set term postscript eps color solid blacktext "Helvetica" 14
     7.5 +# set output 'loradtn.eps'
     7.6 +# set size 4,4
     7.7 +
     7.8 +set terminal png nocrop enhanced size 1024,768
     7.9 +set output 'loradtn-2017-01-13.png'
    7.10 +
    7.11 +set datafile separator ","
    7.12 +set xdata time
    7.13 +set timefmt "%Y-%m-%d %H:%M:%S"
    7.14 +
    7.15 +os='2017-01-13 11:00:00'
    7.16 +oe='2017-01-13 16:00:00'
    7.17 +
    7.18 +set title "Loradtn power (Mech. Eng. roof)"
    7.19 +set key below 
    7.20 +
    7.21 +r1=1700
    7.22 +r2=1800
    7.23 +r3=1900
    7.24 +r4=2000
    7.25 +
    7.26 +nospike=0
    7.27 +spike=1
    7.28 +newdata=2
    7.29 +
    7.30 +set xrange [os:oe]
    7.31 +set yrange [1500:19000]
    7.32 +set y2range [-6000:8000]
    7.33 +
    7.34 +set ylabel "mV"
    7.35 +set y2label "mA"
    7.36 +set ytics nomirror
    7.37 +
    7.38 +set ytics (\
    7.39 +"OVERRIDE" 5000,\
    7.40 +"UP" 4500,\
    7.41 +"STBYSHORT" 4000,\
    7.42 +"STBYLONG" 3500,\
    7.43 +"SLEEP" 3000,\
    7.44 +"OFF" 2500,\
    7.45 +"14500" 14500,\
    7.46 +"14000" 14000,\
    7.47 +"13500" 13500,\
    7.48 +"13000" 13000,\
    7.49 +"12500" 12500,\
    7.50 +"12000" 12000,\
    7.51 +"11500" 11500,\
    7.52 +"11000" 11000,\
    7.53 +"spike" 10050)
    7.54 +
    7.55 +set y2tics ( 4000, 3500, 3000, 2500, 2000, 1500, 1000, 500, 0, -500, -1000, "spike" -2000 )
    7.56 +
    7.57 +
    7.58 +set pointsize 10
    7.59 +
    7.60 +plot 'sedded-battery.log' using 1: ( ($2 == r1 && $7 != newdata) ? ( ( ($7 == spike) ? 10050 : (10 * $4) ) ) : 1/0 ) axes x1y1 title "mV" with points ps 1, \
    7.61 +     'sedded-battery.log' using 1: ( ($2 == r1 && $7 != newdata) ? ( ( ($7 == spike) ?   -2000 :       $5  ) ) : 1/0 ) axes x1y2 title "mA" with points ps 1, \
    7.62 +     'sedded-battery.log' using 1: ( ($2 == r1) ? (2000 + $6) : 1/0 ) axes x1y1 title "state" with step
    7.63 +
     8.1 Binary file daily/loradtn-2017-01-13.png has changed
     9.1 --- a/doit.sh	Fri Jan 13 12:11:43 2017 +0000
     9.2 +++ b/doit.sh	Fri Jan 13 13:10:05 2017 +0000
     9.3 @@ -1,6 +1,52 @@
     9.4  #!/bin/bash
     9.5  
     9.6 -./battery-seds.sh battery.log >sedded-battery.log
     9.7 -gnuplot loradtn.gpl
     9.8 +set -x
     9.9  
    9.10 +if [ "$1" != "noup" ]
    9.11 +then
    9.12 +	state=`./checkup.sh`
    9.13  
    9.14 +	if [ "$state" == "up" ]
    9.15 +	then
    9.16 +		ssh basil.dsg.cs.tcd.ie scp loradtn@tunloradtn:/var/log/battery.log .
    9.17 +		scp basil.dsg.cs.tcd.ie:battery.log .
    9.18 +		./battery-seds.sh battery.log >sedded-battery.log
    9.19 +	else 
    9.20 +		echo "Node not up."
    9.21 +	fi
    9.22 +else
    9.23 +	./battery-seds.sh battery.log >sedded-battery.log
    9.24 +	gnuplot loradtn.gpl
    9.25 +	exit
    9.26 +fi
    9.27 +
    9.28 +if [ "$1" == "today" ]
    9.29 +then
    9.30 +	today=`date --rfc-3339=date`
    9.31 +	cat loradtn.gpl \
    9.32 +		| sed -e 's/2017-01-01/'$today'/' \
    9.33 +		| sed -e 's/2017-01-31/'$today'/' \
    9.34 +		| sed -e 's/loradtn.png/loradtn-'$today'.png/' \
    9.35 +			>daily/loradtn-$today.gpl
    9.36 +	gnuplot daily/loradtn-$today.gpl
    9.37 +	mv loradtn-$today.png daily
    9.38 +	hg add daily/loradtn-$today.*
    9.39 +else 
    9.40 +	if [ "$1" != "" ]
    9.41 +	then
    9.42 +		# assume parameter is nicely formed date
    9.43 +		theday=$1
    9.44 +		cat loradtn.gpl \
    9.45 +			| sed -e 's/2017-01-01/'$theday'/' \
    9.46 +			| sed -e 's/2017-01-31/'$theday'/' \
    9.47 +			| sed -e 's/loradtn.png/loradtn-'$theday'.png/' \
    9.48 +				>daily/loradtn-$theday.gpl
    9.49 +		gnuplot daily/loradtn-$theday.gpl
    9.50 +		mv loradtn-$theday.png daily
    9.51 +		hg add daily/loradtn-$theday.*
    9.52 +	else
    9.53 +		gnuplot loradtn.gpl
    9.54 +	fi
    9.55 +fi
    9.56 +
    9.57 +
    10.1 Binary file loradtn-20170111.png has changed
    11.1 Binary file loradtn-20170112.png has changed
    12.1 --- a/loradtn.gpl	Fri Jan 13 12:11:43 2017 +0000
    12.2 +++ b/loradtn.gpl	Fri Jan 13 13:10:05 2017 +0000
    12.3 @@ -10,11 +10,7 @@
    12.4  set timefmt "%Y-%m-%d %H:%M:%S"
    12.5  
    12.6  os='2017-01-01 11:00:00'
    12.7 -oe='2017-01-31 12:00:00'
    12.8 -
    12.9 -# for one day
   12.10 -#os='2017-01-13 11:00:00'
   12.11 -#oe='2017-01-13 16:00:00'
   12.12 +oe='2017-01-31 16:00:00'
   12.13  
   12.14  set title "Loradtn power (Mech. Eng. roof)"
   12.15  set key below 
    13.1 Binary file loradtn.png has changed
    14.1 --- a/sedded-battery.log	Fri Jan 13 12:11:43 2017 +0000
    14.2 +++ b/sedded-battery.log	Fri Jan 13 13:10:05 2017 +0000
    14.3 @@ -849,3 +849,55 @@
    14.4  2017-01-13 12:02:39,1700,pbmd,1246,-138,2500,0
    14.5  2017-01-13 12:03:48,1700,pbmd,1246,138,2500,0
    14.6  2017-01-13 12:04:57,1700,pbmd,1253,83,2500,0
    14.7 +2017-01-13 12:06:06,1700,pbmd,1241,-9,2500,0
    14.8 +2017-01-13 12:07:15,1700,pbmd,1240,-83,2500,0
    14.9 +2017-01-13 12:08:24,1700,pbmd,1244,138,2500,0
   14.10 +2017-01-13 12:09:33,1700,pbmd,1238,46,2500,0
   14.11 +2017-01-13 12:10:43,1700,pbmd,1235,-212,2500,0
   14.12 +2017-01-13 12:11:52,1700,pbmd,1231,-212,2500,0
   14.13 +2017-01-13 12:13:01,1700,pbmd,1230,-212,2500,0
   14.14 +2017-01-13 12:14:10,1700,pbmd,1230,-212,2500,0
   14.15 +2017-01-13 12:15:19,1700,pbmd,1230,-212,2500,0
   14.16 +2017-01-13 12:16:28,1700,pbmd,1227,-305,2500,0
   14.17 +2017-01-13 12:17:37,1700,pbmd,1224,-379,2500,0
   14.18 +2017-01-13 12:18:46,1700,pbmd,1221,-453,2500,0
   14.19 +2017-01-13 12:19:55,1700,pbmd,1222,-453,2500,0
   14.20 +2017-01-13 12:21:04,1700,pbmd,1222,-416,2500,0
   14.21 +2017-01-13 12:22:13,1700,pbmd,1222,-434,2500,0
   14.22 +2017-01-13 12:23:22,1700,pbmd,1218,-379,2500,0
   14.23 +2017-01-13 12:24:31,1700,pbmd,1221,-397,2500,0
   14.24 +2017-01-13 12:25:40,1700,pbmd,1218,-453,2500,0
   14.25 +2017-01-13 12:26:49,1700,pbmd,1218,-453,2500,0
   14.26 +2017-01-13 12:27:58,1700,pbmd,1218,-471,2500,0
   14.27 +2017-01-13 12:29:07,1700,pbmd,1221,-471,2500,0
   14.28 +2017-01-13 12:30:16,1700,pbmd,1218,-305,2500,0
   14.29 +2017-01-13 12:31:25,1700,pbmd,1222,-305,2500,0
   14.30 +2017-01-13 12:32:34,1700,pbmd,1221,-360,2500,0
   14.31 +2017-01-13 12:33:43,1700,pbmd,1224,-157,2500,0
   14.32 +2017-01-13 12:34:52,1700,pbmd,1235,508,2500,0
   14.33 +2017-01-13 12:36:01,1700,pbmd,1260,1008,2500,0
   14.34 +2017-01-13 12:37:10,1700,pbmd,1263,952,2500,0
   14.35 +2017-01-13 12:38:19,1700,pbmd,1279,1174,2500,0
   14.36 +2017-01-13 12:39:28,1700,pbmd,1297,1526,2500,0
   14.37 +2017-01-13 12:40:37,1700,pbmd,1307,1396,2500,0
   14.38 +2017-01-13 12:41:46,1700,pbmd,1306,1341,2500,0
   14.39 +2017-01-13 12:42:56,1700,pbmd,1325,1692,2500,0
   14.40 +2017-01-13 12:44:05,1700,pbmd,1326,1618,2500,0
   14.41 +2017-01-13 12:45:14,1700,pbmd,1306,952,2500,0
   14.42 +2017-01-13 12:46:23,1700,pbmd,1282,434,2500,0
   14.43 +2017-01-13 12:47:32,1700,pbmd,1295,749,2500,0
   14.44 +2017-01-13 12:48:41,1700,pbmd,1263,194,2500,0
   14.45 +2017-01-13 12:49:50,1700,pbmd,1269,471,2500,0
   14.46 +2017-01-13 12:50:59,1700,pbmd,1282,915,2500,0
   14.47 +2017-01-13 12:52:08,1700,pbmd,1298,1082,2500,0
   14.48 +2017-01-13 12:53:17,1700,pbmd,1275,379,2500,0
   14.49 +2017-01-13 12:54:26,1700,pbmd,1290,1211,2500,0
   14.50 +2017-01-13 12:55:35,1700,pbmd,1291,416,2500,0
   14.51 +2017-01-13 12:56:44,1700,pbmd,1312,1174,2500,0
   14.52 +2017-01-13 12:57:53,1700,pbmd,1313,1211,2500,0
   14.53 +2017-01-13 12:59:02,1700,pbmd,1313,1119,2500,0
   14.54 +2017-01-13 13:00:11,1700,pbmd,1297,749,2500,0
   14.55 +2017-01-13 13:01:20,1700,pbmd,1282,360,2500,0
   14.56 +2017-01-13 13:02:29,1700,pbmd,1273,397,2500,0
   14.57 +2017-01-13 13:03:38,1700,pbmd,1273,1674,2500,1
   14.58 +2017-01-13 13:04:47,1700,pbmd,1331,1230,2500,0