# script to display the differential pressure. This thing generates a plot from # data in logfiles. The result gets generated as a png file, and the script # is intended to be invoked from a higher level perl script which generates # a dynamical web page, containing this image. # Definition of core file, number of points, sampling, source directory, # target directory etc. These parameters get set via some direct input of the # calling script to adapt for things which should not be static in the # gnuplot script. For testing, uncomment the appropriate lines below. # core="AHU2"; outfilename="AHU2_p_1500.png" # num=1500; evr=1; ofmt= "%m/%d\n%H:%M"; # num=10800; evr=10; ofmt= "%a\n%m/%d\n%H:%M"; # num=46000; evr=30; ofmt= "%m/%d" # num=120000; evr=120; ofmt= "%b/%y"; # Some directory paths # logdir="/home/chris/construction/BTUmetering/log" # imgdir="/home/chris/construction/BTUmetering/web/img" # Define the output format and size of the resulting graphic set terminal png font "DroidSansMono,11" size 640,480 set output imgdir.'/'.outfilename set title core # define function to convert voltage into pressure bar(x)=(x/0.18-4.0)/16.0*3.0 # define time format for input set xdata time set timefmt "%m/%d/%y %H:%M:%S" # This is the source file plus a filter for the last n entries srcfile='< tail -n '.num.' '.logdir.'/pressure_'.core.'.log' # Proper date text on this plot set format x ofmt # format for pressure between 0..3bar set format y "%1.3g" set ylabel "CHW Differential Pressure (bar)" set grid xtics ytics # Do the actual plot plot srcfile every evr using 1:(bar($3)) w l linecolor rgb "#ff0000" notitle