2 # Tero Salminen 2013 for project Log-plotter
3 # Timo Kokkonen http://git.itanic.dy.fi/?p=log-plotter
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.
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.
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/>.
18 # Commandline usage with example values unless ran from log-plotter
20 # gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" cell_volt.plot
22 set output "cell_volt.png"
25 ttext1=" - Cell voltage & Charge current "
27 set title chg_name.ttext1.cell_cnt.ttext2
29 # Setting the graphics size from log-plotter variables
32 set term png size gsizex,gsizey
34 # Setting layout and label & legends etc
38 set datafile separator ";"
39 set key out bot hor center samplen 1
40 set timestamp "%d.%m.%Y - %H:%M" top offset -1,-1 font ",8"
41 set ylabel "Voltage [V]"
44 set y2label "Current [A]"
46 set y2tics border nomirror
47 set xlabel "Time [minutes]"
51 # extract the 'time' cell for xtics
52 stats datafile nooutput
53 stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput
56 #set xtics based on elapsed time
58 if (time > 300) set xtics 1 nomirror;
59 if (time > 900) set xtics 2 nomirror;
60 if (time > 1800) set xtics 5 nomirror;
62 # Draw the plot based on log-plotter's variable cell-count
63 if (cell_cnt==1) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
64 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
66 if (cell_cnt==2) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
67 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
68 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
70 if (cell_cnt==3) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
71 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
72 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
73 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
75 if (cell_cnt==4) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
76 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
77 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
78 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
79 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
81 if (cell_cnt==5) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
82 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
83 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
84 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
85 datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \
86 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
88 if (cell_cnt==6) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
89 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
90 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
91 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
92 datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \
93 datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \
94 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
96 if (cell_cnt==7) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
97 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
98 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
99 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
100 datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \
101 datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \
102 datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \
103 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
105 if (cell_cnt==8) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
106 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
107 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
108 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
109 datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \
110 datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \
111 datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \
112 datafile using ($3/60):(($14 > 0 ? $14 : NaN)) axes x1y1 with lines title "Cell 8", \
113 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
115 if (cell_cnt==9) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
116 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
117 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
118 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
119 datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \
120 datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \
121 datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \
122 datafile using ($3/60):(($14 > 0 ? $14 : NaN)) axes x1y1 with lines title "Cell 8", \
123 datafile using ($3/60):(($15 > 0 ? $15 : NaN)) axes x1y1 with lines title "Cell 9", \
124 datafile using ($3/60):($6) axes x1y2 with lines title "Current";
126 if (cell_cnt==10) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \
127 datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \
128 datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \
129 datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \
130 datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \
131 datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \
132 datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \
133 datafile using ($3/60):(($14 > 0 ? $14 : NaN)) axes x1y1 with lines title "Cell 8", \
134 datafile using ($3/60):(($15 > 0 ? $15 : NaN)) axes x1y1 with lines title "Cell 9", \
135 datafile using ($3/60):(($16 > 0 ? $16 : NaN)) axes x1y1 with lines title "Cell 10", \
136 datafile using ($3/60):($6) axes x1y2 with lines title "Current";