[Phphtmllib-devel] SF.net SVN: phphtmllib:[3469] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-06-16 22:15:32
|
Revision: 3469 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3469&view=rev Author: hemna Date: 2010-06-16 22:15:26 +0000 (Wed, 16 Jun 2010) Log Message: ----------- hacks 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-16 21:58:39 UTC (rev 3468) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-16 22:15:26 UTC (rev 3469) @@ -59,7 +59,7 @@ $airport = $this->cache->get($icao); if ($airport != null) { - $wxInfo["runways"] = $this->get_runways($airport); + $wxInfo["runways"] = $this->get_runways($airport, $wxInfo); } $this->metars[] = $wxInfo; @@ -69,7 +69,7 @@ return $wxInfo; } - protected function get_runways($airport) { + protected function get_runways($airport, $wxInfo) { $runways = $airport["runways"]; $info = array(); @@ -78,19 +78,48 @@ $info[] = array("number" => $runway["runway_number"], "length" => $runway["length"], "width" => $width); - $xw = $this->get_crosswind($runway["runway_number"], $runway["Wind"]); - $runway["crosswind"] = $xw; + $xw = $this->do_crosswind($runway, $wxInfo["Wind"]); } return $info; } - protected function get_crosswind($number, $wind) { - $number = substr($runway,0,2)."0"; + protected function do_crosswind($runway, $wind) { + $number = substr($runway["runway_number"],0,2)."0"; $direction = $wind["angle"]; $speed = $wind["speed"]; - return $speed * sin($direction - $number); + $xw = $speed * sin(($direction - $number)*.0174); + + $runway["crosswind1"] = $xw; + + $left_right = $direction - $number; + $diff = abs($left_right); + $p = .0174*$diff; + + $q = abs($speed*sin($p)); + $m = abs($speed*cos($p)); + + $runway["crosswind2"] = $q; + $runway["headwind"] = $m; + + +// +// l = Rway.runwayd.value; +// n = Rway.wdirection.value; +// k = Rway.wspeed.value; +// o = Math.abs(n - l); +// oo = (n - l); //determine left or right relative wind +// p = .0174*o; +// q = Math.abs(k*(Math.sin(p))); +// m = Math.abs(k*(Math.cos(p))); +// Rway.cwresult.value=eval(Math.round(q)); +// +// Rway.cwresultloss.value=eval(Math.round(m)); + + + + return $xw } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |