HMS100-CO added, Dewpoint for ks300, webcam/picture-support

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@125 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinhaas
2007-12-21 12:27:09 +00:00
parent d343a854d3
commit 49995b287d
6 changed files with 88 additions and 16 deletions

View File

@@ -37,26 +37,19 @@ function bft($windspeed) # wind speed in Beaufort
return($bft);
}
# saturation vapour pressure, approximation for
# temperature range 0°C .. +100,9°C
# see http://www.umnicom.de/Elektronik/Projekte/Wetterstation/Sensoren/SattDruck/SattDruck.htm
function svp($temperature) # saturation vapour pressure in hPa
{
$c1= 6.10780; # hPa
$c2= 17.09085;
$c3= 234.175; # °C
return($c1*exp(($c2*$temperature)/($c3+$temperature)));
}
# see http://www.umnicom.de/Elektronik/Projekte/Wetterstation/Sensoren/Taupunkte/Taupunkte.htm
# see http://de.wikipedia.org/wiki/Taupunkt, http://en.wikipedia.org/wiki/Dewpoint
# The dew point (or dewpoint) is the temperature to which a given parcel of air must be cooled, at constant
# barometric pressure, for water vapor to condense into water. The condensed water is called dew. The dew point
# is a saturation point.
# approximation valid for -30°C < $temp < 70°C
function dewpoint($temp,$hum) # dew point and temperature in °C, humidity in %
{
$svp= svp($temp);
$log= log10($svp*$hum/100.0);
return( (234.67*$log-184.2)/(8.233-$log));
$log= log($hum/100.0);
return( (241.2*$log+(4222.03716*$temp)/(241.2+$temp))/(17.5043-$log-(17.5043*$temp)/(241.22+$temp)) );
}
function randdefine()
{
$rand1 = rand(500,20000);

View File

@@ -147,6 +147,7 @@ $avgmonth=$_GET['avgmonth'];
ImageTTFText ($im, $fontsize, 0, 3, 10, $txtcolor, $fontttf, $text);
$fontsize=9;
$text=$temp." &#176;C";
$tvalue= $temp;
ImageTTFText ($im, $fontsize, 0, 90-$XcorrectMainTextKS, 37, $txtcolor, $fontttfb, $text);
$text= $drawks;
ImageTTFText ($im, 8, 0, 90-$XcorrectMainTextKS, 22, $txtcolor, $fontttfb, $text);
@@ -207,6 +208,7 @@ $avgmonth=$_GET['avgmonth'];
ImageTTFText ($im, $fontsize, 0, 3, 10, $txtcolor, $fontttf, $text);
$fontsize=9;
$text=$temp." %";
$hvalue= $temp;
ImageTTFText ($im, $fontsize, 0, 90-$XcorrectMainText, 37, $txtcolor, $fontttfb, $text);
$fontsize=7;
$text="min= $min max= $max";
@@ -214,6 +216,20 @@ $avgmonth=$_GET['avgmonth'];
$imh=$im;
# dewpoint
if ($showdewpointks300='yes')
{
$dp = sprintf("%3.1f", dewpoint($tvalue,$hvalue));
$fontsize=9;
$text=$dp." °C";
ImageTTFText ($im, $fontsize, 0, 350, 35, $bg1p, $fontttfb, $text);
$txtcolor=$orange;
$fontsize=7;
$text="Dewpoint";
ImageTTFText ($im, $fontsize, 0, 350, 47, $bg1p, $fontttf, $text);
}
#wind/Air Pressure
$im = ImageCreateTrueColor($imgmaxxks,$imgmaxyks);
ImageFill($im, 0, 0, $bg2p);