# # Tero Salminen 2013 for project Log-plotter # Timo Kokkonen http://git.itanic.dy.fi/?p=log-plotter # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Commandline usage with example values unless ran from log-plotter # directly: # gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" cell_volt.plot set output "cell_volt.png" # Build title ttext1=" - Cell voltage & Charge current " ttext2="S battery" set title chg_name.ttext1.cell_cnt.ttext2 # Setting the graphics size from log-plotter variables gsizex=sizex gsizey=sizey set term png size gsizex,gsizey # Setting layout and label & legends etc set lmargin 9 set rmargin 8 set tmargin 3 set datafile separator ";" set key out bot hor center samplen 1 set timestamp "%d.%m.%Y - %H:%M" top offset -1,-1 font ",8" set ylabel "Voltage [V]" set format y "%.2f" set ytics nomirror set y2label "Current [A]" set format y2 "%.1f" set y2tics border nomirror set xlabel "Time [minutes]" set format x "%.0f" set grid y # extract the 'time' cell for xtics stats datafile nooutput stats datafile u (lastdatapoint=$3) every ::STATS_records-1::STATS_records-1 nooutput time= int(STATS_max) #set xtics based on elapsed time set xtics 1 nomirror if (time > 300) set xtics 1 nomirror; if (time > 900) set xtics 2 nomirror; if (time > 1800) set xtics 5 nomirror; # Draw the plot based on log-plotter's variable cell-count if (cell_cnt==1) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==2) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==3) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==4) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==5) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==6) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \ datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==7) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \ datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \ datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==8) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \ datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \ datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \ datafile using ($3/60):(($14 > 0 ? $14 : NaN)) axes x1y1 with lines title "Cell 8", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==9) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \ datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \ datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \ datafile using ($3/60):(($14 > 0 ? $14 : NaN)) axes x1y1 with lines title "Cell 8", \ datafile using ($3/60):(($15 > 0 ? $15 : NaN)) axes x1y1 with lines title "Cell 9", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current"; if (cell_cnt==10) plot datafile using ($3/60):(($7 > 0 ? $7 : NaN)) axes x1y1 with lines title "Cell 1", \ datafile using ($3/60):(($8 > 0 ? $8 : NaN)) axes x1y1 with lines title "Cell 2", \ datafile using ($3/60):(($9 > 0 ? $9 : NaN)) axes x1y1 with lines title "Cell 3", \ datafile using ($3/60):(($10 > 0 ? $10 : NaN)) axes x1y1 with lines title "Cell 4", \ datafile using ($3/60):(($11 > 0 ? $11 : NaN)) axes x1y1 with lines title "Cell 5", \ datafile using ($3/60):(($12 > 0 ? $12 : NaN)) axes x1y1 with lines title "Cell 6", \ datafile using ($3/60):(($13 > 0 ? $13 : NaN)) axes x1y1 with lines title "Cell 7", \ datafile using ($3/60):(($14 > 0 ? $14 : NaN)) axes x1y1 with lines title "Cell 8", \ datafile using ($3/60):(($15 > 0 ? $15 : NaN)) axes x1y1 with lines title "Cell 9", \ datafile using ($3/60):(($16 > 0 ? $16 : NaN)) axes x1y1 with lines title "Cell 10", \ datafile using ($3/60):($6) axes x1y2 with lines title "Current";