File='./output2.csv'
|
|
|
|
|
|
set y2tics border
|
|
# 6 Volts is about cutoff
|
|
set y2range [11:14]
|
|
# shorten range, if batteries are charged.
|
|
set yrange [500:700]
|
|
set term jpeg size 1920,1280
|
|
set output 'homesolar.jpg'
|
|
set title 'Home Solar' font ',20'
|
|
set xlabel 'Iteration #'
|
|
set ylabel 'ADC Reading: Current'
|
|
set y2label 'Volts'
|
|
|
|
|
|
samples(x) = $0 > 4 ? 5 : ($0+1)
|
|
avg5(x) = (shift5(x), (back1 + back2 + back3 + back4 + back5) / samples($0))
|
|
shift5(x) = (back5 = back4, back4 = back3, back3 = back2, back2 = back1, back1 = x)
|
|
init(x) = (back1 = back2 = back3 = back4 = back5 = sum = 0)
|
|
|
|
|
|
plot sum = init(0), \
|
|
File using 3:(avg5($2)) title 'Current' with lines axes x1y1,\
|
|
File using 3:(avg5($1)) title 'Battery Voltage' with lines axes x1y2
|
|
#File using 3:(avg5($1)) title 'Battery Voltage' with lines axes x1y2
|
|
|
|
|
|
#plot File using 4:1 with lines axes x1y2, File using 4:2 with lines axes x1y1,\
|
|
#File using 4:3 with lines axes x1y1"
|
|
|
|
#file looks like this:
|
|
|
|
#12.55 583 40
|
|
#12.55 582 41
|
|
#12.55 570 42
|
|
#12.55 571 43
|
|
#12.55 600 44
|
|
#12.55 588 45
|
|
#12.55 579 46
|
|
#12.55 572 47
|
|
#12.55 587 48
|