Hamburger Hamburger

Heating and Ventilation Control

/HV_showHouse

Keine Erläuterungen gefunden.

<?php 
/* published under GPL www.gnu.org/licenses/gpl.html */
function HV_showHouse($sens,$act,$opMod){
  include("HV_colorMap.php");
  /*
  print_r($sens); echo "<br>";
  print_r($act); echo "<br>";
  print_r($opMod); echo "<br>";
  */
  
  global $self;
  #set the markers as  in SVG
  $colorTmp["coll"]=" #d50000";
  $colorTmp["THot"]=" #d45500";
  $colorTmp["TLow"]=" #000081";
  $colorTmp["flow"]=" #009300";
  $colorTmp["ret"]="";
  $colorTmp["ret1"]=" #00d200";
  $colorTmp["ret2"]=" #bca1f6";
  $colorTmp["fire"]=" #bccccc";
  $colorTmp["solar"]=" #aa8800";
  $colorTmp["oven"]=" #dc9cff";
  $colorTmp["vent"]=" #123456";
  $colorTmp["pump"]=" #dc9c6a";
  $colorTmp["haus"]=" #123456";
  $colorTmp["serv"]=" #abcdef";
  $colorTmp["TAmb"]=" #0012e2";
  $colorTmp["Tpipe"]=" #11c9e2";
  $colorTmp["erde"]=" #36d71d";
  $colorTmp["zulu"]=" #ebf106";
  $colorTmp["ablu"]=" #f0a708";
  $colorTmp["folu"]=" #11257c";
  $colorTmp["Theat"]=" #d45511";
  $colorTmp["level"]="dummy";
  $colorTmp["bypa"]="dummy";
  $colorTmp["posBp"]=" #";
  $colorTmp["H2O"]=" #";
  $tempvent["vent1"]=" #d3c17c";
  $tempvent["vent2"]=" #d38d7c";
  $tempvent["vent3"]=" #d3257c";
  $strTmp["coll"]="Tcoll";
  $strTmp["THot"]="TtHot";
  $strTmp["TLow"]="TtLow";
  $strTmp["flow"]="Tflow";
  $strTmp["ret"] ="";
  $strTmp["ret1"] ="Tret1";
  $strTmp["ret2"] ="";
  $strTmp["fire"] ="Tfire";
  $strTmp["TAmb"] ="Tamb";
  $strTmp["Tpipe"]="";
  $strTmp["erde"]="Terde";
  $strTmp["zulu"]="Tzulu";
  $strTmp["ablu"]="Tablu";
  $strTmp["folu"]="Tfolu";
  $strTmp["walu"]="Twalu";
  $strTmp["haus2"]="Thaus";
  $strTmp["Theat"]="Theat";
  $strTmp["posBp"]="foo";
  $strTmp["H2O"]="H2O";
  $strTmp["PV"]="Ppv";
  $sens['Tpipe']=0.5*($sens['TAmb']+$sens['erde']);
  /*
  if($act["pump"]>0){
    $sens['Theat']=$sens["THot"];
  }else{
    $sens['Theat']=$sens['zulu'];
  }
  */
  $sens['Theat']=$sens['walu'];
  $sens["ret1"]=$sens["ret"];
  $TroomSp = 23.1;
  if($sens["fire"]>$TroomSp+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++){
    if (isset($colorTmp[$keys[$k]])){
      list($bgc,$tc) = HV_colorMap($sens[$keys[$k]]);
        if(strlen($colorTmp[$keys[$k]])>5 AND strlen($bgc)>5){
      	  $cmd = "perl -pi -e 's/".$colorTmp[$keys[$k]]."/".$bgc."/g'  showHouse.svg";
      	  exec($cmd);
          /*
          if($keys[$k]=="Theat"){
              echo $sens['Theat']."<br>";
              echo $cmd."<p>";
          }
          */
        }
    }
  } #k
  /* set sensor values */
  for($k=0;$k<count($keys);$k++){
    if (isset($strTmp[$keys[$k]]) AND $sens[$keys[$k]]>-100){
      #echo $keys[$k]." ".$strTmp[$keys[$k]]." ".$sens[$keys[$k]]."<br>";
      if(strlen($strTmp[$keys[$k]])>2 AND strlen($sens[$keys[$k]])>2){
        $cmd = "perl -pi -e 's/".$strTmp[$keys[$k]]."/".$sens[$keys[$k]]."/g' showHouse.svg";
        exec($cmd);
      }
    } #fi
  } #k
  /* set color of vent level */
  $bgc=" #ff0000";
  $off=" #ffffff";
  if($act['vent']<=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($act['vent']<=0.34){
    $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($act['vent']<=0.67){
    $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($act['vent']>=0.99){
    $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 "pump":
      if($opMod['pump']=="on"){
	$actColor="green";
      }elseif($opMod['pump']=="off"){
	  $actColor="red";
      }else{
        if($act[$keys[$k]]<=0.0){
          $actColor="yellow";
	}else{
	  $actColor="green";
        }
      }
      break;
    case "solar":
      if($opMod['solar']=="on"){
	$actColor="green";
      }elseif($opMod['solar']=="off"){
	  $actColor="red";
      }else{
        if($act[$keys[$k]]<=0.0){
          $actColor="yellow";
	}else{
	  $actColor="green";
        }
      }
      break;
    case "oven":
      if($opMod['oven']=="on"){
	$actColor="green";
      }elseif($opMod['oven']=="off"){
	  $actColor="red";
      }else{
        if($act[$keys[$k]]<0.5){
	  $actColor="yellow";
	}else{
	  $actColor="green";
	}
      }
      break;
    default:
      $actColor="";
    }

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

  /* color the water reservoir */
  for($i=0;$i<10;$i++){
    $ii=($i+1)*10;
    if($ii==100){$ii=99;}
    if($sens['H2O']>$ii){
      $res="";
      $cmd0 = "grep -n 'zisterne".$ii."' showHouse.svg";
      exec($cmd0,$res);
      if(isset($res[0])){
	$lnNo = explode(":",$res[0]);
	$lnNo[0] = $lnNo[0]+2;
	$cmd1 = "perl -pi -e 's/opacity:0/opacity:1/ if $. == ".$lnNo[0]."' showHouse.svg";
	exec($cmd1);
      }
    }
  }

  /* 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;
}
?>

python

1/HvcLightControl.py
2/HvcHCSR04ultrasonic.py
3/HvcPV.py
4/HvcMotorDriver.py
5/HvcRollerShutter.py
6/manGenMqttMap.py
7/HvcReadSPI.py
8/HvcMqtt.py
9/HvcTables.py
10/HvcMain.py
11/HvcSetGPIO.py
12/HvcWifiRelay.py
13/HvcOperationMode.py
14/HvcControl.py
15/HvcRaw2phys.py
16/HvcWeather.py
17/HvcOneWire.py
18/makeDoc.py
19/HvcFronius.py
20/EnergyManager.py
21/HvcSendI2C.py

php

1/HV_colorMap.php
2/HV_Admin_Login.php
3/HV_readOperationState.php
4/HV_setParameters.php
5/HV_config.php
6/EM_handleJSON.php
7/index.php
8/readFilenames.php
9/HV_restart.php
10/HV_moveGate.php
11/HV_showLog.php
12/HV_RollerShutter.php
13/EM_editParameter.php
14/HV_serviceLog.php
15/HV_H2Olevel.php
16/HV_TempCal.php
17/HV_Fronius.php
18/EM_plot.php
19/readNamedData.php
20/HV_composeH2Oplot.php
21/HVdoc.php
22/HV_showWeatherForecast.php
23/HV_showHouse.php

Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.