'; // --------------------------------------------------------------------- $css=''; echo $css; // --------------------------------------------------------------------- ?>

GotIn

"; require_once ("movingAvg.php"); require_once ("regressionAnalysis.php"); include_once ("graph2.php"); include_once ("readConfig.php"); // ############################################################################## // ***** Leakage W0-W1=Rov*DT +1/2*Lov*DT(w0+w1-(W0+W1)) // Rov = inside building water vapor generation rate in Kg/(hour * ft^3) // Lov = leakage of air into building in ft^3 air/(hour * volume of building in ft^3) // DT is the time step in hours =T1-T0 // w0 =outside air water content at step T0 and w1=water content at T1 // W0 = inside air water content at step T0 and W1=water content at T1 // ############################################################################## include_once("Ex5a.php"); // ****************************************************** $colors=Array("red","blue","black","darkgreen","purple","gray"); $config=new readConfig("bldg1"); //print_r($config->sensorList); if(empty($sql)) $sql=new sqlServer($config->dbhostname[$sqlCase], $config->dbusername[$sqlCase],$config->dbpassword[$sqlCase],"gr31:$pr"); // ============================================================================= $p=0; if(h($p)) {fwrite($myfile,"sqlCase=$sqlCase\n"); $hostname=$config->dbhostname[$sqlCase]; $username=$config->dbusername[$sqlCase];$password=$config->dbpassword[$sqlCase]; fwrite($myfile,"hostname=$hostname username=$username password=$password\n");} // ============================================================================== // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // ************************************************************** // * public $temp $humid $inWaterContent $outWaterContent // * public $ntemp $nhumid $outTemp $outHumid $wspd $wdir // * $conds $time $deltat $insolation $wspdDeltat $naturalGas $electric // * Add: a) difference between inside and outside water content // * Add: b) outside relative humidity // * ************************************************************** // ; // <<<<<<<<<<<<************* // ====================================================================================== // ************************************************************************************* // ************************************************************************************* // define variables and set to empty values $dol='$'; //--------------------------- $heatcool1=$COOLING; $dispfit =$CURVEFIT; $heat="Heating"; // default $cool="Cooling"; $heatcool=$heat; $heatCool[$cool]=$COOLING; $heatCool[$heat]=$HEATING; //--------------------------- $display="Display Data"; $fit ="Fit Energy Usage"; $sameYScale="$sp2 Select same Y Scale for Data Plots"; $sameyscale=0; $syscale=""; // -------------------------- $displayFit=$display; // ***** Default is display data $displayFit=$fit; // ***** Default Radio Button // -------------------------- $dispFit[$display]=$DISPDATA; $dispFit[$fit] =$CURVEFIT; //--------------------------- $e36=$e37=$e38=$e39=$e40=""; $p=0; if($p) {$e36="e36"; $e37="e37"; $e38="e38"; $e39="e39"; $e40="e40";} $rawData="Raw Data"; $onePoint="1 point"; $twoPoints="2 points"; $fourPoints="4 points"; $eightPoints="8 points"; $sixteenPoints="16 points"; $thirtyTwoPoints="32 points"; //--------------------------- $movAvgPoints[$rawData]=0; $movAvgPoints[$onePoint]=1; $movAvgPoints[$twoPoints]=2; $movAvgPoints[$fourPoints]=4; $movAvgPoints[$eightPoints]=8; $movAvgPoints[$sixteenPoints]=16; $movAvgPoints[$thirtyTwoPoints]=32; $movavg=$movAvgPoints[$eightPoints]; // ***** Default echo ' '; //--------------------------- $h3="

"; $he="

"; global $pts; $pts=0; // ***** default is use raw data $da[0]=Array(null,"Time","time"); // ***** time in seconds from 1/1/1970 0:0:0 $da[0]=getDa($da[0],null,"e9f0 :".__LINE__); // ***** time as a string $da[1]=$timeSecs=Array(null,"Time in Seconds from 1/1/1970", "timeSecs"); $da[1]=getDa($da[1],null,"e9f1 :".__LINE__); $cnt=count($da [1][0])-1; $loweri=0; $upperi=$cnt+1; // ============================================================================== $p=1; if($p) {$li=__LINE__; fwrite($myfile,"$li:e31 da[0][0][0]=".$da[0][0][0]." da[0][0][cnt]=".$da[0][0][$cnt]."\n");} // ============================================================================== // ***** retrieve oldest date in data //if(!isset($graphStartDateDb)) { $graphStartDateDb=gtDate($da[0][0][0],0); $graphStartDate=$graphStartDateDb; // ============================================================================== $p=0; if($p) {$li=__LINE__; fwrite($myfile,"e31a:$li, da[0][0][0]=".$da[0][0][0]. "
\ngraphStartDateDb->gtDate() =".print_r($graphStartDateDb,true)."
\n");} // ============================================================================== //} // ***** retrieve newest data in data //if(!isset($graphEndDateDb)) { $graphEndDateDb=gtDate($da[0][0][$cnt],0); $graphEndDate=$graphEndDateDb; // ============================================================================== $p=0; if($p) {$li=__LINE__; fwrite($myfile, "e31b:$li, da[0][0][cnt]=".$da[0][0][$cnt]."
\ngraphEndDateDb->gtDate() =". print_r($graphEndDateDb,true)."
\n");} // ============================================================================== //} if(isset($graphStartDateDb) && isset($graphEndDateDb)) reduceData("e34"); // ---------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------- if(array_key_exists("REQUEST_METHOD",$_SERVER) && $_SERVER["REQUEST_METHOD"] == "POST") { // ===================================================================================== $p=0; if($p) {$li=__LINE__;foreach($_POST as $kp=>$post) fwrite($myfile,"$li:kp=$kp post=".print_r($post,true)."
");} // ===================================================================================== // ---------------------------------------------------------------------------------- // ================================================================================================ unset($sel); $p=0; if(h($p)) {$li=__LINE__; fwrite($myfile,"e9:$li print_r(_POST)=".print_r($_POST,true). "\n");} // ================================================================================================= $heatcool=$_POST["heatcool"]; // ================================================================= foreach($_POST as $pk=>$val) { // ================================================================= $p=0; if($p) {$li=__LINE__; fwrite($myfile,"e33a0:$li pk=$pk val=$val\n");} // ================================================================= if(eregi("sameYScale",$pk)) { $sameyscale=1; $syscale='checked="checked"'; // ================================================================= $p=0; if($p) {$li=__LINE__; fwrite($myfile,"e33a1: $li pk=$pk sameyscale=$sameyscale syscale=$syscale
");} // ================================================================= continue; } // ================================================================= if(eregi("startDate",$pk)) { $startDate=gtDate($_POST[$pk],2); $graphStartDateDb=$startDate; reduceData("e34a"); // ============================================================================== $p=0; if($p) {$li=__LINE__; fwrite($myfile,"e33:$li: val=$val pk=$pk _POST[$pk]=".$_POST[$pk]." graphStartDateDb->gtDate()=".$graphStartDateDb->gtDate()." loweri=$loweri upperi=$upperi
");} // ============================================================================== continue; } // ================================================================= if(eregi("endDate",$pk)) { $endDate=gtDate($_POST[$pk],2); $graphEndDateDb=$endDate; reduceData("e34b"); // ============================================================================== $p=0; if($p) {$li=__LINE__; fwrite($myfile,"
e33a:$li pk=$pk _POST[$pk]=".$_POST[$pk]." graphEndDateDb->gtDate()=".$graphEndDateDb->gtDate()." loweri=$loweri upperi=$upperi
");} // ============================================================================== continue; } if(eregi("Submit",$pk)||eregi("timeSec",$pk)) continue; // ================================================================== $p=0; if(h($p)) {$li=__LINE__; fwrite($myfile,"e3:$li pk=$pk val=$val\n");} // ================================================================== $sel[]=$pk; if(array_key_exists($val,$movAvgPoints)) { $pts=$movAvgPoints[$val]; // ================================================================== $p1=0; if(h($p1)) {fwrite($myfile,"e3a: pts=$pts val=$val movAvgPoints[val]=".$movAvgPoints[$val]."\n");} // ================================================================= } $ake=array_key_exists($val,$dispFit); if($ake) {$dispfit=$dispFit[$val]; $p=0; if(h($p)) {fwrite($myfile,"e4: ake=$ake val=$val; dispfit=$dispfit\n");}} $heatcool1=$COOLING; // ***** default is cool if(array_key_exists($val,$heatCool)) $heatcool=$heatCool[$val]; } // ====================================================================== $p=0; if(h($p)) {$li=__LINE__; fwrite($myfile,"e5:$li pts=$pts dispfit=$dispfit heatcool1=$heatcool1\n");} // ====================================================================== } // ***** end of 'if ($_SERVER["REQUEST_METHOD"] == "POST") {' // *********************************************************************************** $fName="{$prefix}sensorStatus.html"; echo "

Barkley Group: Energy Usage Page

Sensor Status"; // MKB echo '
'; // ------------------------------------------------------------------- 1 // ------------------------------------------------------------------- 1 $tt1='Heating uses Energy in a Different Way than Cooling. Please Select One '; // ------------------------------------------------------------------- 1 if(array_key_exists("heatcool",$_POST)) $heatcool=$_POST["heatcool"]; echo "
$h3 1)$e36 Please Select Heating or Cooling Mode $he $tt1
"; // -------- $chk=(isset($heatcool) && $heatcool==$heat)?"checked":""; echo "$heat
"; // -------- $chk=(isset($heatcool) && $heatcool==$cool)?$chk="checked":""; echo "$cool
"; // -------------------------------------------------------------------- 2 --> // -------------------------------------------------------------------- 2 --> $tt1='Real Time Data is fairly Noisy. Please select the Number of Points On either Side of Current Point to use to form a Moving Average. 8 Points is Suggested'; // -------------------------------------------------------------------- 2 --> echo " $h3 2)$e37 Please Select The number of points for the Moving Average Smoothing Window (8 points is the default)$he $tt1"; // ----------------------------- $ff=Array($rawData,$onePoint,$twoPoints,$fourPoints,$eightPoints,$sixteenPoints,$thirtyTwoPoints); $movavg=$movAvgPoints[$eightPoints]; for($i=0;$i$f"; } echo "
"; // ---------------------------------------------------------------------- 3 // ---------------------------------------------------------------------- 3 $tt1='There are two Options. 1) display graphs of the selected data or 2) Display graph of actual energy usage against a multiple regression model using the selected data. This option will show a reduction in energy usage, in the case of a successful retrofit was implemented. If "Display Data" was chosen user should select one or more items from sections 4 and 5 below If the "Fit Energy Usage" radio button was selected, then user should select one item from section 4 and 1 or more items from section 5 green below.'; // ----------------------------------------------------------------------- 3 if(array_key_exists("displayFit",$_POST)) $displayFit=$_POST["displayFit"]; echo ""; flush();/*HERE */ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // --------------------------------------------------------------------- $syscale=" "; echo ""; // --------------------------------------------------------------------- initDa(0); addTables(0); foreach($da as $key=>$val) { $dol.$val[2].'=""'; } // ***********************************************************************************\ // ***** $depcbox[] ********************** Dependent Variables ****** //print_r($depda); $depcnt=count($depda); $depcbox=Array(); for($i=0;$i<$depcnt;$i++) { $j=sprintf("%2d",$i+1); $val=$depda[$i]; $description=$sp2.$val[1]; $fileName=trim($val[2]); $depcbox[$i]=' '."$j. $description"; // ============================================================================ $p=0; if($p) {$v0=$val[0]; $v1=$val[1]; $v2=$val[2]; $li=__LINE__; fwrite($myfile,"e35:$li $i v0=$v0 v1=$v1 v2=$v2
\n");} // ============================================================================ } // ******* cbox[] Independent Variables ******** //foreach($da as $vkey=>$vda) fwrite($myfile, "vkey=$vkey ".print_r($vda,true)."
\n"); $cnt=count($da); $cbox=Array(); for($i=5;$i<$cnt;$i++) { $val=$da[$i]; $j=$i-4; $description=$sp2.$val[1]; $fileName=trim($val[2]); $cbox[$i-5]=' '."$j. $description"; // ============================================================================ $p=0; if($p) {$v0=$val[0]; $v1=$val[1]; $v2=$val[2]; $li=__LINE__; fwrite($myfile,"e35a:$li $i v0=$v0 v1=$v1 v2=$v2
\n");} // ============================================================================ } // ****************************************************************************** $stop=0; // ****** Form Verification /* as if($graphEndDateDb->key>$graphEndDate->key) {fwrite($myfile,"j0 Graph end date=".$graphEndDateDb->gtDate()." cannot be later than last Available data=".$graphEndDate->gtDate()."
"); $stop=1;} // --------------------------------- if($graphStartDateDb->key<$graphStartDate->key) {fwrite($myfile,"j1 Graph start date=".$graphStartDateDb->gtDate()." cannot be earlier than earliest Available data=".$graphStartDate->gtDate()."
"); $stop=1;} //----------------------------------- if($graphStartDateDb->key > $graphEndDateDb->key) {fwrite($myfile,"j2 Graph Start date=".$graphStartDateDb->gtDate()." cannot be Later than Graph End Date=".$graphEndDateDb->gtDate()."
"); $stop=1;} */ // ****************************************************************************** // ------------------------------------------------------------------- 4 $tt1=" The System Supports Gas and/or electric usage. It will support water, Steam, Oil and Other utilities in the future, as required"; // 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) 4) $tit4="$h3 4)$e39 Please Choose 1 Energy, Utility or Dependent Variable Type $he"; // -------------------------------------------------------------------- 4 echo "
$h3 3)$e38 Please Select Display Data or Display Energy Usage.
Next, enter the Start & End Dates of the Graphs to be produced
(Default is Plot All Available Dates)$he $tt1
"; // ----------------------------- 3.1 $chk=(isset($displayFit) && $displayFit==$display)?"checked":""; echo "".ucfirst($display).$sp5; // ----------------------------- 3.2 $chk=(isset($displayFit) && $displayFit==$fit )?"checked":""; echo "".ucfirst($fit); // ----------------------------- Enter Start and End Dates Of Graph ---- 3.3 & 3.4 // =========================================================================================================== $p=1; if($p) {$li=__LINE__; fwrite($myfile,"e37:\n graphStartDateDb=".print_r($graphStartDateDb,true)." \n graphEndDateDb=".print_r($graphEndDateDb,true) );} // =========================================================================================================== // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv $gsd=$graphStartDateDb->gtDate(); echo "

Graph Start Date: "; // ----------------------------- Enter Start and End Dates Of Graph ---- 3.3 & 3.4 $ged=$graphEndDateDb->gtDate(); echo "{$sp4}Graph End Date:

$sameYScale
"; $col="$col".$depcbox[0]."". $col .$depcbox[1]."". $col .$depcbox[2].""; echo "
$tit4 $tt1
"; echo "
"; // ******** $cbox Independent Variables ********* // ---------------------------------------------------------------------- 5 $tt1="The system can plot any number of variables on one graph with multiple Y axes using different scales. If one tries to plot more than 4 variables on one graph, things quickly become so busy that the graphs are difficult to read. The following check boxes represents data that is available to the program. This data originates from various sensors and/or The Weather UnderGround Website. Some of the check boxes represent compound data which is formed by algebraically combining one or more measured variables. One can plot similar variables on the same Y scale by selecting the 'Same Y Scale' checkbox in section 3 above"; // -------------------- 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) 5) $tit5="$h3 5)$e40 Please Choose 1 or more items below to see combined plots for those items Versus Energy Use. Please choose green items below to model energy use.$he"; // ---------------------------------------------------------------------- 5 $submit=''; // ---------------------------------------------------------------------- 5 echo "$submit"; //$col=""; for($i=0;$i< count($cbox);$i++) echo ""; //for($i=9;$i<$cnt;$i++ ) echo ''; // ------------------------------------------------------------------------------- --> echo "$submit
$tit5 $tt1
".$cbox[$i]."
'. $cbox[$i].'
"; // ***** $dispfit: 0==display (default) 1=curve fit // ***** $heatcool1: 0==cool(default) 1==heat $options=""; if($dispfit==$DISPDATA) $options.="display data
"; else $options.="curve fit of Energy usage
"; if($heatcool1==$COOLING) $options.="cooling mode
"; else $options.="heating mode
"; if($pts >0) $options.="moving average over $pts Points
"; if($pts==0) $options.="Raw Data
"; if(!$stop) { displayData($sameyscale); displayCurveFit(); } echo ""; // ************************************************************************************* ?>