# script to display the power consumption. 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_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"; # ofmt="%m/%d\n%H:%M"; # Some directory paths # logdir="/home/chris/construction/BTUmetering/log" # imgdir="/home/chris/construction/BTUmetering/web/img" # set maxima for display for maintenance bugs MAXTEMP=25.0 MAXPOWER=250.0 # Define the output format and size of the resulting graphic set terminal png font "DroidSansMono,11" size 640,640 set output imgdir.'/'.outfilename # have both plots in same image set multiplot title core # define time format for input set xdata time set timefmt "%m/%d/%y %H:%M:%S" # This is the source file srcfile='< tail -n '.num.' '.logdir.'/heat_'.core.'.log' # instantaneous power is the top plot set size 1,0.45 set origin 0,0.5 # No date text on this plot set format x "" # Y range should cover 0..200 kW; let's choose 4d digits to be aligned w temp set format y "%4.0f" set ylabel "Heat load (kW)" set grid xtics ytics # Do the actual plot plot srcfile every evr using 1:($5>MAXPOWER?{0,1}:$5) w l notitle # Second plot, for temperatures set size 1,0.49 set origin 0,0.01 # date text on this plot set format x ofmt # y format: covers 6...20 celsius, one decimal set format y "%4.3g" set ylabel 'CHW supply / return temp (deg C)' set grid xtics ytics set yrange [:] # Do the actual plot plot srcfile every evr using 1:($6>MAXTEMP?{0,1}:$6) w l notitle, \ '' using 1:($7>MAXTEMP?{0,1}:$7) w l linecolor rgb "#0000ff" notitle