]> git.itanic.dy.fi Git - log-plotter/blob - volt_cur.plot
Add charging current and total charge into the status field
[log-plotter] / volt_cur.plot
1 #
2 #    Tero Salminen 2013 for project Log-plotter
3 #    Timo Kokkonen http://git.itanic.dy.fi/?p=log-plotter
4 #
5 #    This program is free software: you can redistribute it and/or modify
6 #    it under the terms of the GNU General Public License as published by
7 #    the Free Software Foundation, either version 3 of the License, or
8 #    (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
17 #
18 #    Commandline usage with example values unless ran from log-plotter
19 #    directly:
20 #    gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" volt_cur.plot
21
22 set output "volt_cur.png"
23
24 # Build title
25 ttext1=" - Battery voltage & charged capacity "
26 ttext2="S battery"
27 set title chg_name.ttext1.cell_cnt.ttext2
28
29 # Setting the graphics size from log-plotter variables
30 gsizex=sizex
31 gsizey=sizey
32 set term png size gsizex,gsizey
33
34 # Setting layout and label & legends etc
35 set lmargin 10
36 set rmargin 10
37 set tmargin 3
38 set datafile separator ";"
39 set key out bot hor center samplen 2
40 set timestamp "%d.%m.%Y - %H:%M" top offset -1,-1 font ",8"
41 set ylabel "Voltage [V]"
42 set format y "%.2f"
43 set ytics 0.25
44 set xlabel "Time [minutes]"
45 set format x "%.0f"
46 set y2label "Capacity [mAh]"
47 set y2tics border
48 set grid y
49
50 # extract the 'time' cell for xtics
51 stats datafile nooutput
52 stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput
53 time= int(STATS_max)
54
55 #set xtics based on elapsed time
56 set xtics 1 nomirror
57 if (time > 300) set xtics 1 nomirror;
58 if (time > 900) set xtics 2 nomirror;
59 if (time > 1800) set xtics 5 nomirror;
60
61 # Draw the plot based on log-plotter's variable cell-count
62 plot    datafile using ($3/60):($5) axes x1y1 with lines title "Voltage", \
63         datafile using ($3/60):($19) axes x1y2 with lines title "Capacity"