[Phphtmllib-devel] SF.net SVN: phphtmllib:[3513] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-06-18 03:45:28
|
Revision: 3513 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3513&view=rev Author: hemna Date: 2010-06-18 03:45:21 +0000 (Fri, 18 Jun 2010) Log Message: ----------- pressure altitude Modified Paths: -------------- trunk/open2300/lib/modules/api/AviationWeather.inc Modified: trunk/open2300/lib/modules/api/AviationWeather.inc =================================================================== --- trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-18 02:10:33 UTC (rev 3512) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-18 03:45:21 UTC (rev 3513) @@ -66,6 +66,7 @@ if ($metar != null && strlen($metar) > 0) { $this->process_metar($metar, $wxInfo); $wxInfo["metar"] = $metar; + $airport = $this->cache->get($icao); if ($airport != null) { @@ -81,6 +82,9 @@ $this->cache->set($icao,$airport); } } + + //now do Pressure Altitude and Density Altitude + $wxInfo["PressureAltitude"] = $this->pressure_altitude($wxInfo["BaroHPA"], $wxInfo["altitude"]); } //$this->metars[] = $wxInfo; //need to combine this info w/ the airport data cache. @@ -619,6 +623,31 @@ $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); return $offset/3600; } + + + protected function pressure_altitude($pressure, $altitude) { + // Pressure Altitude + // Palt = ( 1 - (P / 1013.25) ^ .190284) * 145366.45 + + $Pst = 1013.25; + $Pexp = .190284; + $fn = 145366.45; + + $tmp1 = $pressure/$Pst; + $tmp2 = pow($tmp1, $Pexp); + + $Pa = $fn * (1 - pow(($pressure/$Pst) , $Pexp)); + + return round($Pa + $altitude,1); + } + + + protected function density_altitude() { + + } + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |