Commit eca9882b authored by Andrey Filippov's avatar Andrey Filippov

spiral search

parent e7c0ea42
...@@ -272,35 +272,41 @@ printf($rslt); ...@@ -272,35 +272,41 @@ printf($rslt);
exit (0); exit (0);
/**
* Scan rectangular AZ/EL window arownd expected satellite position, alternating
/* * azimuth directions and increasing elevation offset.
Start rotation * Start with expected elevation and low az margin, scan azimuth to high margin,
$AZ_CMAX = 4790; * then alternatively increase/decrease elevation
$EL_CMAX = 10979; * @param $threshold - minimal modem signal strength
$SK_CMAX = 931; * @param $DishAngleCenter - array of (elevation, azimuth, skew) in degrees,
* corresponding to the center of the scan window
* @param $wnd_az - full range of azimuth scan in degrees
* @param $wnd_el - full range of elevation scan in degrees
* @param $scan_step - elevation scan step
* @return SimpleXMLElement -
*/ */
function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step){ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step){
global $motosat_url,$LATE_STOP_AZ,$dbg_file; global $motosat_url,$LATE_STOP_AZ,$dbg_file;
$DishAngle = Array($DishAngleCenter[0],$DishAngleCenter[1],$DishAngleCenter[2]); $DishAngle = Array($DishAngleCenter[0],$DishAngleCenter[1],$DishAngleCenter[2]);
$pass = 0; $dir = 0;
for ($DishAngle[1] = $DishAngleCenter[1] - $wnd_el/2; for ($delta_el = 0.0; $delta_el < $wnd_el/2; $delta_el += $scan_step) {
$DishAngle[1] <= ($DishAngleCenter[1] + $wnd_el/2); $passes = ($delta_el > 0.0)? 2 : 1;
$DishAngle[1]+= $scan_step) { for ($pass = 0; $pass < $passes; $pass++) {
// for ($dir = 0; $dir < 2; $dir++) {
if ($pass & 1) { if ($dir > 0){
$az_start = $DishAngleCenter[0] + $wnd_az/2; $DishAngle[1] = $DishAngleCenter[1] + $delta_el;
$az_end = $DishAngleCenter[0] - $wnd_az/2; $az_start = $DishAngleCenter[0] + $wnd_az/2;
} else { $az_end = $DishAngleCenter[0] - $wnd_az/2;
$az_start = $DishAngleCenter[0] - $wnd_az/2; } else {
$az_end = $DishAngleCenter[0] + $wnd_az/2; $DishAngle[1] = $DishAngleCenter[1] - $delta_el;
} $az_start = $DishAngleCenter[0] - $wnd_az/2;
$az_end = $DishAngleCenter[0] + $wnd_az/2;
}
$DishAngle[0] = $az_start; $DishAngle[0] = $az_start;
if ($dbg_file) { if ($dbg_file) {
fprintf($dbg_file, "\npass=%d:\n",$pass); fprintf($dbg_file, "\ndir=%d:\n",$dir);
fprintf($dbg_file, "wnd_az=%f:\n",$wnd_az); fprintf($dbg_file, "wnd_az=%f:\n",$wnd_az);
fprintf($dbg_file, "wnd_el=%f:\n",$wnd_el); fprintf($dbg_file, "wnd_el=%f:\n",$wnd_el);
fprintf($dbg_file, "threshold=%f:\n",$threshold); fprintf($dbg_file, "threshold=%f:\n",$threshold);
...@@ -311,11 +317,6 @@ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step) ...@@ -311,11 +317,6 @@ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step)
fprintf($dbg_file, print_r($DishAngleCenter,1)); fprintf($dbg_file, print_r($DishAngleCenter,1));
} }
// while (true) {
// $counts = moveElAzSk_degrees($DishAngle);
// if (!isset($counts)) break;
// }
while (null !==moveElAzSk_degrees($DishAngle)); while (null !==moveElAzSk_degrees($DishAngle));
$DishAngle[0] = $az_end; $DishAngle[0] = $az_end;
...@@ -346,7 +347,7 @@ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step) ...@@ -346,7 +347,7 @@ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step)
foreach ($DishCount as $key => $value){ foreach ($DishCount as $key => $value){
$DishCount[$key] = $value + 0; $DishCount[$key] = $value + 0;
} }
if ($pass & 1){ if ($dir > 0){
$DishCount[0] += $LATE_STOP_AZ; $DishCount[0] += $LATE_STOP_AZ;
} else { } else {
$DishCount[0] -= $LATE_STOP_AZ; $DishCount[0] -= $LATE_STOP_AZ;
...@@ -367,13 +368,10 @@ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step) ...@@ -367,13 +368,10 @@ function scan_window($threshold, $DishAngleCenter, $wnd_az, $wnd_el, $scan_step)
return $xml_state; return $xml_state;
} }
$pass ++; }
$dir = 1-$dir;
} }
moveElAzSk_degrees($DishAngleCenter); moveElAzSk_degrees($DishAngleCenter);
// while (true) {
// $counts = moveElAzSk_degrees($DishAngleCenter);
// if (!isset($counts)) break;
// }
while (null !==moveElAzSk_degrees($DishAngleCenter)); while (null !==moveElAzSk_degrees($DishAngleCenter));
$xml_state = simplexml_load_file($motosat_url); $xml_state = simplexml_load_file($motosat_url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment