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

tableInterpol

Is used by:
HV_readTemperatures

It is a usual procedure to have some characteristic curve as set of points. With respect to some specific input value the appropriate interval has to be identified and the neighbouring values have to be interpolated.

If the input value exceeds the intervall of points, the result may either be saturated to the last defined value or extrapolated from the last two points, depending on $mode.

$points is a list of points defining the characteristic curve. Each point consists of a x value as input and a y value for the depending result.

<?php 
/* published under GPL www.gnu.org/licenses/gpl.html */
function tableInterpol($points,$x,$mode){
    $NoPoints=count($points);	
  /* test out of interval */
  switch($mode){
  case "saturate":
    $xmin=$points[0]["x"];
    $ymin=$points[0]["y"];
    $xmax=$points[$NoPoints-1]["x"];
    $ymax=$points[$NoPoints-1]["y"];
    if($x<=$xmin){
      $y=$ymin;
      return $y;
    }
    if($x>=$xmax){
      $y=$ymax;
      return $y;
    }
    break;
  case "extrapolate":
  default:
    $xmin=$points[0]["x"];
    $ymin=$points[0]["y"];
    $xminp1=$points[1]["x"];
    $yminp1=$points[1]["y"];
    $xmax=$points[$NoPoints-1]["x"];
    $ymax=$points[$NoPoints-1]["y"];
    $xmaxm1=$points[$NoPoints-2]["x"];
    $ymaxm1=$points[$NoPoints-2]["y"];
    if($x<=$xmin){
      $y=$ymin+($yminp1-$ymin)/($xminp1-$xmin)*($x-$xmin);
      return $y;
    }
    if($x>=$xmax){
      $y=$ymax+($ymax-$ymaxm1)/($xmax-$xmaxm1)*($x-$xmax);
      return $y;
    }
  }
  /* interpolate table */
  for($p=0;$p<$NoPoints;$p++){
    $xLeft=$points[$p]["x"];
    $yLeft=$points[$p]["y"];
    $xRight=$points[$p+1]["x"];
    $yRight=$points[$p+1]["y"];
    if($xLeft<$x AND $x<=$xRight){
      $y=$yLeft+($yRight-$yLeft)/($xRight-$xLeft)*($x-$xLeft);
      return $y;
    } #fi
  } #p
}


/*
$solarPumpOnDuration[0]['x']=60;  $solarPumpOnDuration[0]['y']=5;
$solarPumpOnDuration[1]['x']=100; $solarPumpOnDuration[1]['y']=25;
echo " 5 = ".tableInterpol($solarPumpOnDuration,50,"saturate")."\n";
echo "15 = ".tableInterpol($solarPumpOnDuration,80,"saturate")."\n";
echo "25 = ".tableInterpol($solarPumpOnDuration,110,"saturate")."\n";
echo " 0 = ".tableInterpol($solarPumpOnDuration,50,"extrapolate")."\n";
echo "15 = ".tableInterpol($solarPumpOnDuration,80,"extrapolate")."\n";
echo "30 = ".tableInterpol($solarPumpOnDuration,110,"extrapolate")."\n";
*/
?>
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!