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_showHouse

Is used by:
index

To visualize the status of my building equipment I drew a SVG image using Inkscape. All colors and strings which will be used for indicating may occur only once in the image! For visualization the template is copied to a new name and than perl is used to replace the relevant items one by one...

Since there are 256 colors at least, it should be no problem to provide a specific color to each indicator. The used colors are given in the array $template and $Templ at the beginning of the script. Be carefull not to use any of the colors which are part of the HV_colorMap.

The state of the actuators is red to indicate 'off', green for 'on' or 'active' and yellow if automatic controls decides to 'deactivate' or 'auto off' the actuator.

example01 example01 example01

<?php 
/* published under GPL www.gnu.org/licenses/gpl.html */
function HV_showHouse($sens,$act,$vent){
  include("HV_colorMap.php");
  global $self;
  $template["coll"]="#d50000";
  $template["tHot"]="#d45500";
  $template["tLow"]="#000081";
  $template["flow"]="#009300";
  $template["ret"]="";
  $template["ret1"]="#00d200";
  $template["ret2"]="#bca1f6";
  $template["fire"]="#bccccc";
  $template["solar"]="#aa8800";
  $template["oven"]="#dc9cff";
  $template["vent"]="#123456";
  $template["serv"]="#dc9c6a";
  $template["Tamb"]="#0012e2";
  $template["Tpipe"]="#11c9e2";
  $template["Terde"]="#36d71d";
  $template["Tzulu"]="#ebf106";
  $template["Tablu"]="#f0a708";
  $template["Tfolu"]="#11257c";
  $template["Theat"]="#d45511";
  $tempvent["vent1"]="#d3c17c";
  $tempvent["vent2"]="#d38d7c";
  $tempvent["vent3"]="#d3257c";
  $Ttmpl["coll"]="Tcoll";
  $Ttmpl["tHot"]="TtHot";
  $Ttmpl["tLow"]="TtLow";
  $Ttmpl["flow"]="Tflow";
  $Ttmpl["ret"] ="";
  $Ttmpl["ret1"] ="Tret1";
  $Ttmpl["ret2"] ="";
  $Ttmpl["fire"] ="Tfire";
  $Ttmpl["Tamb"] ="Tamb";
  $Ttmpl["Tpipe"]="";
  $Ttmpl["Terde"]="Terde";
  $Ttmpl["Tzulu"]="Tzulu";
  $Ttmpl["Tablu"]="Tablu";
  $Ttmpl["Tfolu"]="Tfolu";
  $Ttmpl["Theat"]="";
  $sens['Tamb'] =$vent['Tamb'];
  $sens['Tpipe']=0.5*($vent['Tamb']+$vent['Terde']);
  $sens['Terde']=$vent['Terde'];
  $sens['Tzulu']=$vent['Tzulu'];
  $sens['Tablu']=$vent['Tablu'];
  $sens['Tfolu']=$vent['Tfolu'];
  if($GLOBALS['heatMode']=="summer"){
    $sens['Theat']=$vent['Tzulu'];
  }else{
    $sens['Theat']=$sens["tHot"];
  }

  $sens["ret1"]=$sens["ret"];
  $GLOBALS['Troom']=23.1;
  if($sens["fire"]>$GLOBALS['Troom']+15 AND $act['oven']>0){
    $sens["ret2"]=$sens["tHot"];
  }else{
    $sens["ret2"]=min($sens["tHot"],$sens["fire"]);
  }

  /* use template */
  $cmd = "cp ./house.svg ./showHouse.svg";
  exec($cmd);
  /* set thermal colors of elements */
  $keys = array_keys($sens);
  for($k=0;$k<count($keys);$k++){
    list($bgc,$tc) = HV_colorMap($sens[$keys[$k]]);
    if(strlen($template[$keys[$k]])>5 AND strlen($bgc)>5){
      $cmd = "perl -pi -e 's/".$template[$keys[$k]]."/".$bgc."/g'  showHouse.svg";
      exec($cmd);
    }
  } #k
  /* set sensor values */
  for($k=0;$k<count($keys);$k++){
    if(strlen($Ttmpl[$keys[$k]])>3 AND strlen($sens[$keys[$k]])>3){
      $cmd = "perl -pi -e 's/".$Ttmpl[$keys[$k]]."/".$sens[$keys[$k]]."/g' showHouse.svg";
      exec($cmd);
    }
  } #k
  /* set color of vent level */
  $bgc="#ff0000";
  $off="#ffffff";
  if($vent['level']<=0){
    $cmd = "perl -pi -e 's/".$tempvent['vent1']."/".$off."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent2']."/".$off."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent3']."/".$off."/g'  showHouse.svg";
    exec($cmd);
  }elseif($vent['level']<=1){
    $cmd = "perl -pi -e 's/".$tempvent['vent1']."/".$bgc."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent2']."/".$off."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent3']."/".$off."/g'  showHouse.svg";
    exec($cmd);
  }elseif($vent['level']<=2){
    $cmd = "perl -pi -e 's/".$tempvent['vent1']."/".$bgc."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent2']."/".$bgc."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent3']."/".$off."/g'  showHouse.svg";
    exec($cmd);
  }elseif($vent['level']<=3){
    $cmd = "perl -pi -e 's/".$tempvent['vent1']."/".$bgc."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent2']."/".$bgc."/g'  showHouse.svg";
    exec($cmd);
    $cmd = "perl -pi -e 's/".$tempvent['vent3']."/".$bgc."/g'  showHouse.svg";
    exec($cmd);
  }
  /* set state of actuators */
  $keys = array_keys($act);
  for ($k=0;$k<count($keys);$k++){
    switch($keys[$k]){
    case "serv":
      if($GLOBALS['stateServ']=="off"){
	$actColor="red";
      }else{
        $actColor="green";
      }
      break;
    case "solar":
      if($GLOBALS['stateSolar']=="on"){
	$actColor="green";
      }elseif($GLOBALS['stateSolar']=="off"){
	  $actColor="red";
      }else{
        if($act[$keys[$k]]<=0.0){
          $actColor="yellow";
	}else{
	  $actColor="green";
        }
      }
      break;
    case "oven":
      if($GLOBALS['stateOven']=="on"){
	$actColor="green";
      }elseif($GLOBALS['stateOven']=="off"){
	  $actColor="red";
      }else{
        if($act[$keys[$k]]<0.5){
	  $actColor="yellow";
	}else{
	  $actColor="green";
	}
      }
      break;
    }

    if(strlen($template[$keys[$k]])>3 AND strlen($actColor)>=3){
      $cmd = "perl -pi -e 's/".$template[$keys[$k]]."/".$actColor."/g' showHouse.svg";
      exec($cmd);
    }
  } #k

  /* now compose house with colorbar */
  $colorBar = HV_colorMap("bar");
  $result ="<p align='center'><table border='0'><tr><td>\n";
  $result.="<a href='".$self."?what2do=menu'><img src='showHouse.svg'></a>";
  $result.="</td><td align='right' style='width:100px;'>\n";
  $result.=$colorBar;
  $result.="\n</td></tr></table></p>\n";

  return $result;
}
?>
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!