From c83d3f407ba2d93c23f1a9c4be68248d146acf87 Mon Sep 17 00:00:00 2001 From: Tero Salminen Date: Fri, 11 Oct 2013 18:05:06 +0300 Subject: [PATCH] Add improved gnuplot scripts Replace the old and ugly plotter scripts with all new and shiny scripts that produce nice beautiful plots. Signed-off-by: Tero Salminen Signed-off-by: Timo Kokkonen --- bal.plot | 143 +++++++++++++++++++++++++++++++++++++++ balancing.plot | 19 ------ cell_volt.plot | 136 +++++++++++++++++++++++++++++++++++++ draw_plots.sh | 4 -- plot.sh | 5 ++ volt_cur.plot | 63 +++++++++++++++++ voltage_and_current.plot | 15 ---- 7 files changed, 347 insertions(+), 38 deletions(-) create mode 100644 bal.plot delete mode 100644 balancing.plot create mode 100644 cell_volt.plot delete mode 100755 draw_plots.sh create mode 100644 plot.sh create mode 100644 volt_cur.plot delete mode 100644 voltage_and_current.plot diff --git a/bal.plot b/bal.plot new file mode 100644 index 0000000..df161e6 --- /dev/null +++ b/bal.plot @@ -0,0 +1,143 @@ +# +# 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'" bal.plot + +set output "cell_bal.png" + +# Build title +ttext1=" - Cell balance " +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 8 +set rmargin 8 +set tmargin 3 +set datafile separator ";" +set key out bot hor center samplen 2 +set timestamp "%d.%m.%Y - %H:%M" top offset -1,-1 font ",8" +set ylabel "Voltage [mV]" +set y2label "Voltage [mV]" +set y2tics border +set grid y +set xlabel "Time [minutes]" +set format x "%.0f" + +# extract the 'time' cell for xtics based on tital time +stats datafile every ::::0 using 3 nooutput +time = int(STATS_min) + +if (time <= 120) set xtics 0.5 nomirror; +if (time <= 300) set xtics 1 nomirror; +if (time <= 900) set xtics 2 nomirror; +if (time <= 1200) set xtics 3 nomirror; +if (time <= 1800) set xtics 5 nomirror; +if (time > 1800) set xtics 10 nomirror; + +# Count average-value for balance sero-line +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) + +# Draw the plot based on log-plotter's variable cell-count +if (cell_cnt==1) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8) / cell_cnt)*100) with lines title "Cell 1"; + +if (cell_cnt==2) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8) / cell_cnt)*100) with lines title "Cell 2"; + +if (cell_cnt==3) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9) / cell_cnt)*100) with lines title "Cell 3"; + +if (cell_cnt==4) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10) / cell_cnt)*100) with lines title "Cell 4"; + +if (cell_cnt==5) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10 + $11) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10 + $11) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10 + $11) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10 + $11) / cell_cnt)*100) with lines title "Cell 4", \ + datafile using ($3/60):(avg5($11 - ($7 + $8 + $9 + $10 + $11) / cell_cnt)*100) with lines title "Cell 5"; + +if (cell_cnt==6) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10 + $11 + $12) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10 + $11 + $12) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10 + $11 + $12) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10 + $11 + $12) / cell_cnt)*100) with lines title "Cell 4", \ + datafile using ($3/60):(avg5($11 - ($7 + $8 + $9 + $10 + $11 + $12) / cell_cnt)*100) with lines title "Cell 5", \ + datafile using ($3/60):(avg5($12 - ($7 + $8 + $9 + $10 + $11 + $12) / cell_cnt)*100) with lines title "Cell 6"; + +if (cell_cnt==7) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 4", \ + datafile using ($3/60):(avg5($11 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 5", \ + datafile using ($3/60):(avg5($12 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 6", \ + datafile using ($3/60):(avg5($13 - ($7 + $8 + $9 + $10 + $11 + $12 + $13) / cell_cnt)*100) with lines title "Cell 7"; + +if (cell_cnt==8) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 4", \ + datafile using ($3/60):(avg5($11 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 5", \ + datafile using ($3/60):(avg5($12 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 6", \ + datafile using ($3/60):(avg5($13 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 7", \ + datafile using ($3/60):(avg5($14 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14) / cell_cnt)*100) with lines title "Cell 8"; + +if (cell_cnt==9) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 4", \ + datafile using ($3/60):(avg5($11 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 5", \ + datafile using ($3/60):(avg5($12 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 6", \ + datafile using ($3/60):(avg5($13 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 7", \ + datafile using ($3/60):(avg5($14 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 8", \ + datafile using ($3/60):(avg5($15 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15) / cell_cnt)*100) with lines title "Cell 9"; + +if (cell_cnt==10) plot sum=init(0), \ + datafile using ($3/60):(avg5($7 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 1", \ + datafile using ($3/60):(avg5($8 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 2", \ + datafile using ($3/60):(avg5($9 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 3", \ + datafile using ($3/60):(avg5($10 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 4", \ + datafile using ($3/60):(avg5($11 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 5", \ + datafile using ($3/60):(avg5($12 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 6", \ + datafile using ($3/60):(avg5($13 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 7", \ + datafile using ($3/60):(avg5($14 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 8", \ + datafile using ($3/60):(avg5($15 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 9", \ + datafile using ($3/60):(avg5($16 - ($7 + $8 + $9 + $10 + $11 + $12 + $13 + $14 + $15 + $16) / cell_cnt)*100) with lines title "Cell 10"; diff --git a/balancing.plot b/balancing.plot deleted file mode 100644 index 48a1764..0000000 --- a/balancing.plot +++ /dev/null @@ -1,19 +0,0 @@ -set term png size 800,480 - -set datafile separator ";" - -set ylabel "Voltage (mV)" - -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), \ - datafile using (avg5($7 - ($7 + $8 + $9) / 3)), \ - datafile using (avg5($8 - ($7 + $8 + $9) / 3)), \ - datafile using (avg5($9 - ($7 + $8 + $9) / 3)) diff --git a/cell_volt.plot b/cell_volt.plot new file mode 100644 index 0000000..2c102ba --- /dev/null +++ b/cell_volt.plot @@ -0,0 +1,136 @@ +# +# 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 every ::::0 using 3 nooutput +time = int(STATS_min) + +if (time <= 120) set xtics 0.5 nomirror; +if (time <= 300) set xtics 1 nomirror; +if (time <= 900) set xtics 2 nomirror; +if (time <= 1200) set xtics 3 nomirror; +if (time <= 1800) set xtics 5 nomirror; +if (time > 1800) set xtics 10 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"; diff --git a/draw_plots.sh b/draw_plots.sh deleted file mode 100755 index b0686a0..0000000 --- a/draw_plots.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -gnuplot -e "datafile='$1'" voltage_and_current.plot > voltage.png -gnuplot -e "datafile='$1'" balancing.plot > balancing.png diff --git a/plot.sh b/plot.sh new file mode 100644 index 0000000..a74bf70 --- /dev/null +++ b/plot.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" bal.plot +gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" cell_volt.plot +gnuplot -e "datafile='log.log' ; chg_name='iCharger 3010B' ; cell_cnt='6' ; sizex='800' ; sizey='480'" volt_cur.plot diff --git a/volt_cur.plot b/volt_cur.plot new file mode 100644 index 0000000..4604338 --- /dev/null +++ b/volt_cur.plot @@ -0,0 +1,63 @@ +# +# 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'" volt_cur.plot + +set output "volt_cur.png" + +# Build title +ttext1=" - Battery voltage & charged capacity " +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 10 +set rmargin 10 +set tmargin 3 +set datafile separator ";" +set key out bot hor center samplen 2 +set timestamp "%d.%m.%Y - %H:%M" top offset -1,-1 font ",8" +set ylabel "Voltage [V]" +set format y "%.2f" +set ytics 0.25 +set xlabel "Time [minutes]" +set format x "%.0f" +set y2label "Capacity [mAh]" +set y2tics border +set grid y + +# extract the 'time' cell for xtics +stats datafile every ::::0 using 3 nooutput +time = int(STATS_min) + +if (time <= 120) set xtics 0.5 nomirror; +if (time <= 300) set xtics 1 nomirror; +if (time <= 900) set xtics 2 nomirror; +if (time <= 1200) set xtics 3 nomirror; +if (time <= 1800) set xtics 5 nomirror; +if (time > 1800) set xtics 10 nomirror; + +# Draw the plot based on log-plotter's variable cell-count +plot datafile using ($3/60):($5) axes x1y1 with lines title "Voltage", \ + datafile using ($3/60):($19) axes x1y2 with lines title "Capacity" diff --git a/voltage_and_current.plot b/voltage_and_current.plot deleted file mode 100644 index 640ca92..0000000 --- a/voltage_and_current.plot +++ /dev/null @@ -1,15 +0,0 @@ -set term png size 800,480 - -set datafile separator ";" - -set ylabel "Voltage (mV)" -set y2label "Current (mA)" -set y2tics border - -plot datafile using 5 axes x1y1, \ - datafile using 8 axes x1y1, \ - datafile using 9 axes x1y1, \ - datafile using 6 axes x1y2, \ - datafile using 15 axes x1y2 \ - -#plot datafile using 13 -- 2.44.0