';?>

Camalie Vineyards Fermentation Monitors

   />Day / />Week / />Month / />Quarter / />Year
End Time Offset in Days: Plot Resolution(width in pixels): "; $start=time(); #Unix Epoch time in seconds since 1970 $offsetStart=($interval+$offset*24)*3600;#seconds back in time $offsetEnd=$offset*24*3600 + 300;#seconds $end = $start - $offsetEnd; $startx = $start-$offsetStart; $plotAspectRatio = .24;# Plot Height/Width ratio $plotUndersizeFactor = .80; # Undersizing of plot gen relative to print window. Less=clearer text. $printWidth = $_GET['resolution'];#Actual size of image plotted on web page. $printHeight = $printWidth*$plotAspectRatio; $width = $plotUndersizeFactor*$printWidth;#size of graphic generated by RRDtool approx. $height = $plotUndersizeFactor*$printHeight;# RRDtool rounds up plot size based on data. $ERROR = ""; $RRDdir = "/usr/local/rrdtool-1.2.15/share/rrdtool/mkscode/"; $colors = array("ff0000","ffc500","ffff00","ff6000","ff4500","ffc0cb","ff00ff","008000","0000ff","800080","bf0000","bf6500","bfbf00","00c000","0000bf","400040","8f0000","8f3500","8f8f00","002000","00208f","a000a0","4f00b0","dfa500","ffbf00","008040","0020ff","80f080","ff0080","ffa500","df7f00","408080","2020af","801080","ff0000","ffa500","ffff20","006000","0000f0","802080"); #red to violet first 6 $SM12colors = array("87ceff","00009b","579ea0","0000ff","4682b4","000070","8169e1"); $SM24colors = array("87ceff","00009b","579ea0","0000ff","4682b4","000070","8169e1"); $SM36colors = array("87ceff","00009b","579ea0","0000ff","4682b4","000070","8169e1"); $colorIndex = 0; $nodeid = 31; # Temporary $nodeidsAll = array(1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 17, 18, 20, 22, 23, 26, 27, 31, 32, 33, 34, 35, 36, 40, 42, 44, 45, 46, 47); #All nodes active, some dead, 1,2,14. 46,26 high drain. $nodeidsField = array(6,10,20,23,31,32,33,40,42,45); #All nodes with SM sensors $nodeidsNewHouse = array(5,22,31,35,44,40); #Old Garage, Kitchen, Sitting Loft, Media Room, Master Bedroom, New Garage respectively $nodeidsCool = array(7,12,4,44); # Nodes monitoring cool temps, wine storage $nodeidsPA = array(70,71,72,73); #Nodes for monitoring wine temps in Palo Alto $nodeids916 = array(101,103,104,105,110,111,112,113); # 916MHz motes. $nodeids2400 = array(501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526); #all Iris Nodes actually go up to 534 now. $nodeidsIrrBlock1 = array(502,503,526); $nodeidsIrrBlock2 = array(504,505,533); $nodeidsIrrBlock3 = array(506,507,529,513,532); $nodeidsIrrBlock4 = array(509,510,511,512); $nodeidsAvocado = array(532); # block 8 $nodeidsStrauss = array(521,522,523,524,525); # block 7 $nodeidsKonrad = array(516,517,518,519,520,527,528); # block 6 $nodeidsDC = array(514,515);# block 5 $nodeidCistern = "501";#SM1 water level $nodeidTankM = "525";#SM1 at 10K Irrigation storage tank overflow $nodeidMechSys = "531";#ST1 thermal storage tank temp, ST2-pool pre heatxch,ST3-pool post heatxch, SM1-floor moisture $nodeidPool = "534";#ST1 deep, ST2 shallow $nodeidIrrManifold = "11";#ADC6-prefilter pressure,ADC7-post, ADC5 float switch $nodeidStraussLine = "8";#ADC6-Strauss Line Pressure $nodeidCO2Mon = "13"; # ADC5 CO2 concentration $nodeidMainPortOut = "45";// Relay node outside cave main portal $nodeidFermMonABC = "33";// tanks ABC $nodeidFermMonDEF = "47";// tanks DEF $mustTempsABC = array("adc3","adc5","adc7"); $mustPressABC = array("adc2","adc4","adc6"); $mustTempsDEF = array("adc3","adc5","adc7"); $mustPressDEF = array("adc2","adc4","adc6"); $mustLabelsABC = array("A-Carmenere 18.2gal.","B-Cab 54gal.","C-Cab 52gal."); $mustLabelsDEF = array("D-Cab 53gal.","E-Cab 58gal.","F-Merlot 60gal."); $nodeidsIrrBlock = ''; $scDEF = ""; $scLINE = ""; $curveDEFs = array();# initialize arrays to null $curveCDEFs = array(); $curveLINEs = array(); $opts = array(); #********************************************************************************** # Graph of Fermentation Temps for Tanks A,B,C and the ambient temp $curveDEFs=array(); $curveCDEFs=array(); $curveLINEs=array(); $colorIndex = 0; $tankCount = 0; $OTEMPnode = "OTEMP".$nodeidMainPortOut; // Outdoor Ambient Temp relay node outside portal $nodeid = $nodeidFermMonABC; $fermTankID = "ABC"; $BVnode = "BV".$nodeid; $TEMPnode = "TEMP".$nodeid; // Winery Ambient Temp $FTEMPnode = "FTEMP".$nodeid; // Fermentation Temp concatenated with nodeid $FPRESSnode = "FPRESS".$nodeid; // Fermentation Press concatenated with nodeid $curveDEFs[]="DEF:".$BVnode."=".$RRDdir."RRD".$nodeid.".rrd:voltage:LAST";//battery Voltage $curveDEFs[]="DEF:".$TEMPnode."=".$RRDdir."RRD".$nodeid.".rrd:temp:LAST";//ambient temp //$curveDEFs[]="DEF:".$OTEMPnode."=".$RRDdir."RRD45.rrd:temp:LAST"; foreach ($mustTempsABC as $camParam) { //print "$nodeid $camParam \n
"; $curveDEFs[]="DEF:".$camParam.$nodeid."=".$RRDdir."RRD".$nodeid.".rrd:".$camParam.":LAST"; $curveCDEFs[]="CDEF:".$FTEMPnode.$camParam."=6.11,".$camParam.$nodeid.",*,".$BVnode.",".$camParam.$nodeid.",-,/,LOG,-36.85,*,170.96,+,30,100,LIMIT"; $curveLINEs[]="LINE3:".$FTEMPnode.$camParam."#".$colors[$colorIndex].":".$mustLabelsABC[$tankCount]; $colorIndex = $colorIndex +1; $tankCount = $tankCount + 1; } $colorIndex = $colorIndex +1; $curveLINEs[]="LINE3:TEMP".$nodeid."#".$colors[$colorIndex].":Winery Ambient Temp Mote".$nodeid; //$nodeid = "45"; //$colorIndex = $colorIndex +1; //$curveLINEs[]="LINE3:TEMP".$nodeid."#".$colors[$colorIndex].":Outdoor Ambient Temp Mote".$nodeid; //foreach ($curveDEFs as $scDEF){print "$scDEF\n";} //foreach ($curveCDEFs as $scCDEF){print "$scCDEF\n";} //foreach ($curveLINEs as $scLINE){print "$scLINE\n";} $firstopts = array( "--start", "$startx", "--end", "$end", "--title", "Must Fermentation Temps and Ambient Temps", "--vertical-label", "Degrees Fahrenheit", "--interlace", "--imgformat","PNG", "--width=$width", "--height=$height"); $opts = array_merge($firstopts,$curveDEFs,$curveCDEFs,$curveLINEs); //foreach ($opts as $opt){print "$opt
";} $ret = rrd_graph("../html/".$fermTankID.$camParam.".png", $opts, count($opts)); if( !is_array($ret) ) { $err = rrd_error(); echo "rrd_graph() ERROR: $err\n"; } print "

"; #********************************************************************************** # Graph of Fermentation Temps for Tanks D,E,F $curveDEFs=array(); $curveCDEFs=array(); $curveLINEs=array(); //$colorIndex = 0; $colorIndex = $colorIndex +1; $tankCount = 0; $nodeid = $nodeidFermMonDEF; $fermTankID = "DEF"; $BVnode = "BV".$nodeid; $TEMPnode = "TEMP".$nodeid; // Winery Ambient Temp $FTEMPnode = "FTEMP".$nodeid; // Fermentation Temp concatenated with nodeid $FPRESSnode = "FPRESS".$nodeid; // Fermentation Press concatenated with nodeid $curveDEFs[]="DEF:".$BVnode."=".$RRDdir."RRD".$nodeid.".rrd:voltage:LAST";//battery Voltage $curveDEFs[]="DEF:".$TEMPnode."=".$RRDdir."RRD".$nodeid.".rrd:temp:LAST";//ambient temp //$curveDEFs[]="DEF:".$OTEMPnode."=".$RRDdir."RRD45.rrd:temp:LAST"; foreach ($mustTempsDEF as $camParam) { //print "$nodeid $camParam \n
"; $curveDEFs[]="DEF:".$camParam.$nodeid."=".$RRDdir."RRD".$nodeid.".rrd:".$camParam.":LAST"; $curveCDEFs[]="CDEF:".$FTEMPnode.$camParam."=6.11,".$camParam.$nodeid.",*,".$BVnode.",".$camParam.$nodeid.",-,/,LOG,-36.85,*,170.96,+,30,150,LIMIT"; $curveLINEs[]="LINE3:".$FTEMPnode.$camParam."#".$colors[$colorIndex].":".$mustLabelsDEF[$tankCount]; $colorIndex = $colorIndex +1; $tankCount = $tankCount + 1; } $colorIndex = $colorIndex +1; $curveLINEs[]="LINE3:TEMP".$nodeid."#".$colors[$colorIndex].":Winery Ambient Temp Mote".$nodeid; //$nodeid = "45"; //$colorIndex = $colorIndex +1; //$curveLINEs[]="LINE3:TEMP".$nodeid."#".$colors[$colorIndex].":Outdoor Ambient Temp Mote".$nodeid; //foreach ($curveDEFs as $scDEF){print "$scDEF\n";} //foreach ($curveCDEFs as $scCDEF){print "$scCDEF\n";} //foreach ($curveLINEs as $scLINE){print "$scLINE\n";} $firstopts = array( "--start", "$startx", "--end", "$end", "--title", "Must Fermentation Temps and Ambient Temps", "--vertical-label", "Degrees Fahrenheit", "--interlace", "--imgformat","PNG", "--width=$width", "--height=$height"); $opts = array_merge($firstopts,$curveDEFs,$curveCDEFs,$curveLINEs); //foreach ($opts as $opt){print "$opt
";} $ret = rrd_graph("../html/".$fermTankID.$camParam.".png", $opts, count($opts)); if( !is_array($ret) ) { $err = rrd_error(); echo "rrd_graph() ERROR: $err\n"; } print "

"; #********************************************************************************** # Graph of Fermentation Tank Pressures for tanks A,B,C # $curveDEFs=array(); $curveCDEFs=array(); $curveLINEs=array(); //$colorIndex = 0; $tankCount = 0; $nodeid = $nodeidFermMonABC; $fermTankID = "ABC"; $BVnode = "BV".$nodeid; $TEMPnode = "TEMP".$nodeid; // Winery Ambient Temp $OTEMPnode = "OTEMP".$nodeid; // Outdoor Ambient Temp relay node outside portal $FTEMPnode = "FTEMP".$nodeid; // Fermentation Temp concatenated with nodeid $FPRESSnode = "FPRESS".$nodeid; // Fermentation Press concatenated with nodeid foreach ($mustPressABC as $camParam) { //print "$nodeid $camParam \n
"; $curveDEFs[]="DEF:".$camParam.$nodeidFermMonABC."=".$RRDdir."RRD".$nodeidFermMonABC.".rrd:".$camParam.":LAST"; $curveCDEFs[]="CDEF:".$FPRESSnode.$camParam."=".$camParam.$nodeidFermMonABC.",1000,/,.1,-,.555,*,0,2,LIMIT"; $curveLINEs[]="LINE3:".$FPRESSnode.$camParam."#".$colors[$colorIndex].":".$mustLabelsABC[$tankCount]; $colorIndex = $colorIndex +1; $tankCount = $tankCount + 1; } $firstopts = array( "--start", "$startx", "--end", "$end", "--title", "Fermentation Tank Pressures - Must Weights", "--vertical-label", "Pressure (PSI)", "--interlace","-u 1.8","-l 0.","--rigid","--alt-autoscale", "--imgformat","PNG", "--width=$width", "--height=$height", "-W Camalie Networks"); $opts = array_merge($firstopts,$curveDEFs,$curveCDEFs,$curveLINEs); //foreach ($opts as $opt){print "$opt
";} $ret = rrd_graph("../html/".$fermTankID.$camParam.".png", $opts, count($opts)); if( !is_array($ret) ) { $err = rrd_error(); echo "rrd_graph() ERROR: $err\n"; } print "

"; #********************************************************************************** # Graph of Fermentation Tank Pressures for D,E,F # $curveDEFs=array(); $curveCDEFs=array(); $curveLINEs=array(); //$colorIndex = 0; $tankCount = 0; $nodeid = $nodeidFermMonDEF; $fermTankID = "DEF"; $BVnode = "BV".$nodeid; $TEMPnode = "TEMP".$nodeid; // Winery Ambient Temp $OTEMPnode = "OTEMP".$nodeid; // Outdoor Ambient Temp relay node outside portal $FTEMPnode = "FTEMP".$nodeid; // Fermentation Temp concatenated with nodeid $FPRESSnode = "FPRESS".$nodeid; // Fermentation Press concatenated with nodeid foreach ($mustPressDEF as $camParam) { //print "$nodeid $camParam \n
"; $curveDEFs[]="DEF:".$camParam.$nodeidFermMonDEF."=".$RRDdir."RRD".$nodeidFermMonDEF.".rrd:".$camParam.":LAST"; $curveCDEFs[]="CDEF:".$FPRESSnode.$camParam."=".$camParam.$nodeidFermMonDEF.",1000,/,.1,-,.555,*,-.1,2,LIMIT"; $curveLINEs[]="LINE3:".$FPRESSnode.$camParam."#".$colors[$colorIndex].":".$mustLabelsDEF[$tankCount]; $colorIndex = $colorIndex +1; $tankCount = $tankCount + 1; } $firstopts = array( "--start", "$startx", "--end", "$end", "--title", "Fermentation Tank Pressures - Must Weights", "--vertical-label", "Pressure (PSI)", "--interlace","-u 1.8","-l -.1","--rigid","--alt-autoscale", "--imgformat","PNG", "--width=$width", "--height=$height", "-W Camalie Networks"); $opts = array_merge($firstopts,$curveDEFs,$curveCDEFs,$curveLINEs); //foreach ($opts as $opt){print "$opt
";} $ret = rrd_graph("../html/".$fermTankID.$camParam.".png", $opts, count($opts)); if( !is_array($ret) ) { $err = rrd_error(); echo "rrd_graph() ERROR: $err\n"; } print "

"; #********************************************************************************** # Graph of CO2 level in Cave/Winery # $opts = array( "--start", "$startx", "--end", "$end", "--title", "CO2 Level in Winery Tank Room", "--vertical-label", "CO2 Concentration (ppm)", "--interlace","--alt-autoscale", "--imgformat","PNG", "--width=$width", "--height=$height", "-W Camalie Networks", "DEF:CO2conc".$nodeidCO2Mon."=".$RRDdir."RRD".$nodeidCO2Mon.".rrd:adc5:LAST", "CDEF:CO2concX".$nodeidCO2Mon."=CO2conc".$nodeidCO2Mon.",1000,/,750,*,0,10000,LIMIT", "LINE3:CO2concX".$nodeidCO2Mon."#000000:CO2 concentration"); //foreach ($opts as $optx){print "$optx\n";} $ret = rrd_graph("../html/CO2conc.png", $opts, count($opts)); if( !is_array($ret) ) { $err = rrd_error(); echo "rrd_graph() ERROR: $err\n"; } print "

"; ?>
Camalie Networks
Camalie Vineyards

Written by Mark Holler 9/30/08 Send comments or bug reports to mholler@pacbell.net or call 650-799-6571 All rights reserved