1Set up the Raspberry Pi
2Electrical Connection of Sensores and Actuators
3Set up the Connection
4Heating Control

no warranty for any of the provided information

HV_readOperationState

Is used by:
index

Read in the last line of the logfile as input for visualization. Instead of reading the hole file, the command line functions head and tail are used.

The parameter $NoSensors indicates the position where sensor values end and actuator values start.

<?php 
/* published under GPL www.gnu.org/licenses/gpl.html */
function HV_readOperationState($NoSensors){
  /* read logfile */
  $files = readFilenames("./","\.log");
  sort($files);
  $file = $files[count($files)-1];
  $file = escapeshellarg($file);
  $firstLine = `head -n 1 $file`;
  $lastLine  = `tail -n 1 $file`;
  $keys=explode("\t",$firstLine);  
  $values = explode("\t", $lastLine);
  $timeStamp = $values[0];
  /* if logfile is empty use last one */
  if(trim($timeStamp)=="#time"){
    echo "<p>".$file." is empty<br>
         timeStamp is ".$timeStamp."<br>
         using last file</p>";
    $file = $files[count($files)-2];
    $file = escapeshellarg($file);
    $firstLine = `head -n 1 $file`;
    $lastLine  = `tail -n 1 $file`;
    $keys=explode("\t",$firstLine);  
    $values = explode("\t", $lastLine);
    $timeStamp = $values[0];
  }
  for ($k=0;$k<count($keys);$k++){
    $keys[$k]=trim($keys[$k]);
    if ($k>0 AND $k<=$NoSensors){
      $T[$keys[$k]]=sprintf("%4.1f",$values[$k]);
    }elseif($k>$NoSensors){
      $act[$keys[$k]]=$values[$k];
    }else{
    } #fi
  } #k
  /*read log of ventilation */
  $date=substr($file,1,strlen($file)-6);
  $file=$date.".vent";
   if(file_exists($file)){
    $file = escapeshellarg($file);
    $firstLine = `head -n 1 $file`;
    $lastLine  = `tail -n 1 $file`;
    $keys=explode("\t",$firstLine);  
    $values = explode("\t", $lastLine);
    for ($k=1;$k<count($keys);$k++){
      $keys[$k]=trim($keys[$k]);
      $vent[$keys[$k]]=sprintf("%4.1f",$values[$k]);
    } #k
  }else{
    $vent=array();
  }
  /* read weather */
  $date=substr($date,0,strpos($date,"T"));
  $file="ambient".$date.".tsv";
  $lastLine  = `tail -n 1 $file`;
  $values = explode("\t", $lastLine);
  $vent['Tamb']=sprintf("%4.1f",$values[1]);
  return array($timeStamp,$T,$act,$vent);
}
?>
1HV_Admin_Login
2HV_colorMap
3HV_config
4HV_convertASCII
5HV_getSunPrediction
6HV_heatingControl
7HV_loop
8HV_readOperationState
9HV_readTemperatures
10HV_restart
11HV_serviceLog
12HV_setActuators
13HV_setParameters
14HV_showHouse
15HV_showLog
16HV_showRawValues
17HV_showWeatherForecast
18HV_thermos200
19HV_ventProg
20HV_writeLog
21index
22MoistAir
23readFilenames
24readNamedData
25tableInterpol

 

gnuplot

gnuplot is used to visualise the results - via script you can do infinite diagrams in 1 second.
Run 'test' in gnuplot to get an owerview of the available line- and symbolstyles.

Login
Valid HTML 4.01!