Loading test_01.php +62 −38 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,12 @@ $USABLE_FRACT = 0.6; // use ony samples not less than this fraction of maxima $USABLE_POW = 1.0; // transform (maxstrengh - strengh) by applying pow - 1.2 ...1.3 may have marginal improvements $USABLE_POW = 1.0; // transform (maxstrengh - strengh) by applying pow - 1.2 ...1.3 may have marginal improvements $ARGMAX_OURSIDE = 0.2; // Allow argmax outside of the measured range by this fraction $ARGMAX_OURSIDE = 0.2; // Allow argmax outside of the measured range by this fraction $ARGMAX_OURSIDE_2D = 0.0; // Allow argmax outside of the measured range by this fraction during 2D peaking $ARGMAX_OURSIDE_2D = 0.0; // Allow argmax outside of the measured range by this fraction during 2D peaking // Modem never allows wrong satellite to have signal strength above 29, and tries to maintain 30 for the correct one when the signal falls below. // So these values can not be used for peaking(maybe only remove 30 if the signal is going down?) $HUGHES_BAD_STRENGTHS = array(29,30); /* /* http://192.168.1.250/motor.xml?Action=ElUp&Distance=0.5&Units=1 0.5 degree up http://192.168.1.250/motor.xml?Action=ElUp&Distance=0.5&Units=1 0.5 degree up Loading Loading @@ -173,18 +179,9 @@ if ($scan_mode){ exit (0); exit (0); } } // Just move where requested $total_cycles = 0; $total_cycles = 0; if ($multi) { $total_cycles = moveElAzSk_degrees($DishAngle, $multi); while (true) { $cycles = moveElAzSk_degrees($DishAngle); if (!isset ($cycles)) { break; } $total_cycles += $cycles; } } else { $total_cycles = moveElAzSk_degrees($DishAngle); } $xml = new SimpleXMLElement("<?xml version='1.0'?><motosat/>"); $xml = new SimpleXMLElement("<?xml version='1.0'?><motosat/>"); $xml->addChild ('cycles',(string) $total_cycles ); $xml->addChild ('cycles',(string) $total_cycles ); $rslt=$xml->asXML(); $rslt=$xml->asXML(); Loading Loading @@ -329,7 +326,7 @@ function peakAzimuthOrElevation($xml_state, $el_not_az, $azel_play, $azel_range, } } function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet used function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet used global $dbg_file; global $HUGHES_BAD_STRENGTHS, $dbg_file; $min= $data[0][0]; $min= $data[0][0]; $max = $data[0][0]; $max = $data[0][0]; $rows = sizeof($data); $rows = sizeof($data); Loading Loading @@ -358,12 +355,17 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us $xy = $argmax; // x,y pair $xy = $argmax; // x,y pair // put a cell into a queue, in $poly_data and mark a cell as used // put a cell into a queue, in $poly_data and mark a cell as used $queue[] = $xy; $queue[] = $xy; if (! in_array($data[$xy[1]][$xy[0]], $HUGHES_BAD_STRENGTHS)) { $poly_data[] = array( $poly_data[] = array( array(0.0,0.0), // $xy, array( 0.0, 0.0 ), // $xy, array( array( $data[$xy[1]][$xy[0]] $data[$xy[1]][$xy[0]] ) ) ); ); } $cluster[$xy[1]][$xy[0]] = true; $cluster[$xy[1]][$xy[0]] = true; while (sizeof($queue) > 0) { while (sizeof($queue) > 0) { Loading Loading @@ -407,13 +409,18 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us if ($data[$xy[1]][$xy[0]] < $threshold) // signal too weak if ($data[$xy[1]][$xy[0]] < $threshold) // signal too weak continue; // already used continue; // already used $queue[] = $xy; $queue[] = $xy; $cluster[$xy[1]][$xy[0]] = true; if (! in_array($data[$xy[1]][$xy[0]], $HUGHES_BAD_STRENGTHS)) { // use for the wave, but do not use for polynimial maximum $poly_data[] = array( $poly_data[] = array( array($xy[0]-$argmax[0], $xy[1]-$argmax[1]), array( $xy[0] - $argmax[0], $xy[1] - $argmax[1] ), array( array( $data[$xy[1]][$xy[0]] $data[$xy[1]][$xy[0]] ) ) ); ); $cluster[$xy[1]][$xy[0]] = true; } } } } } if ($dbg_file !== null) { if ($dbg_file !== null) { Loading Loading @@ -495,7 +502,7 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us function findMax1d($data, $fract, $pow, $frac_outside = 0.2){ function findMax1d($data, $fract, $pow, $frac_outside = 0.2){ global $dbg_file; global $HUGHES_BAD_STRENGTHS, $dbg_file; $min= $data[0]; $min= $data[0]; $max = $data[0]; $max = $data[0]; $argmax = 0; $argmax = 0; Loading @@ -522,7 +529,12 @@ function findMax1d($data, $fract, $pow, $frac_outside = 0.2){ $poly_data = Array(); $poly_data = Array(); for ($k = $k_min; $k <= $k_max; $k++){ for ($k = $k_min; $k <= $k_max; $k++){ $poly_data[] = Array($k-$argmax, $datap[$k]); if (! in_array($datap[$k], $HUGHES_BAD_STRENGTHS)) { // skip samples with "bad" strengths (see explanation in the $HUGHES_BAD_STRENGTHS declaration $poly_data[] = Array( $k - $argmax, $datap[$k] ); } } } $pa = new PolynomialApproximation(); $pa = new PolynomialApproximation(); Loading Loading @@ -852,22 +864,34 @@ function waitMotorsReady($modem_threshold = 0.0){ // return $try; return $try; } } function moveElAzSk_counts($new_azelsk_count) { function moveElAzSk_counts($new_azelsk_count, $multi = true) { $total_cycles = 0; while (true) { $xml_state = moveElAzSk_start_counts($new_azelsk_count); $xml_state = moveElAzSk_start_counts($new_azelsk_count); if (isset($xml_state)) { if (isset($xml_state)) { $cycles = waitMotorsReady(); $cycles = waitMotorsReady(); return $cycles; // $xml_state; $total_cycles += $cycles; if (!$multi) return $total_cycles; } else return $total_cycles; // did not move last time } } return; } } function moveElAzSk_degrees($new_azelsk_degree) { function moveElAzSk_degrees($new_azelsk_degree, $multi = true) { $total_cycles = 0; while (true) { $xml_state = moveElAzSk_start_degrees($new_azelsk_degree); $xml_state = moveElAzSk_start_degrees($new_azelsk_degree); if (isset($xml_state)) { if (isset($xml_state)) { $cycles = waitMotorsReady(); $cycles = waitMotorsReady(); return $cycles; // $xml_state; $total_cycles += $cycles; if (!$multi) return $total_cycles; } else return $total_cycles; // did not move last time } } return; } } function myval ($s) { function myval ($s) { Loading Loading
test_01.php +62 −38 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,12 @@ $USABLE_FRACT = 0.6; // use ony samples not less than this fraction of maxima $USABLE_POW = 1.0; // transform (maxstrengh - strengh) by applying pow - 1.2 ...1.3 may have marginal improvements $USABLE_POW = 1.0; // transform (maxstrengh - strengh) by applying pow - 1.2 ...1.3 may have marginal improvements $ARGMAX_OURSIDE = 0.2; // Allow argmax outside of the measured range by this fraction $ARGMAX_OURSIDE = 0.2; // Allow argmax outside of the measured range by this fraction $ARGMAX_OURSIDE_2D = 0.0; // Allow argmax outside of the measured range by this fraction during 2D peaking $ARGMAX_OURSIDE_2D = 0.0; // Allow argmax outside of the measured range by this fraction during 2D peaking // Modem never allows wrong satellite to have signal strength above 29, and tries to maintain 30 for the correct one when the signal falls below. // So these values can not be used for peaking(maybe only remove 30 if the signal is going down?) $HUGHES_BAD_STRENGTHS = array(29,30); /* /* http://192.168.1.250/motor.xml?Action=ElUp&Distance=0.5&Units=1 0.5 degree up http://192.168.1.250/motor.xml?Action=ElUp&Distance=0.5&Units=1 0.5 degree up Loading Loading @@ -173,18 +179,9 @@ if ($scan_mode){ exit (0); exit (0); } } // Just move where requested $total_cycles = 0; $total_cycles = 0; if ($multi) { $total_cycles = moveElAzSk_degrees($DishAngle, $multi); while (true) { $cycles = moveElAzSk_degrees($DishAngle); if (!isset ($cycles)) { break; } $total_cycles += $cycles; } } else { $total_cycles = moveElAzSk_degrees($DishAngle); } $xml = new SimpleXMLElement("<?xml version='1.0'?><motosat/>"); $xml = new SimpleXMLElement("<?xml version='1.0'?><motosat/>"); $xml->addChild ('cycles',(string) $total_cycles ); $xml->addChild ('cycles',(string) $total_cycles ); $rslt=$xml->asXML(); $rslt=$xml->asXML(); Loading Loading @@ -329,7 +326,7 @@ function peakAzimuthOrElevation($xml_state, $el_not_az, $azel_play, $azel_range, } } function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet used function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet used global $dbg_file; global $HUGHES_BAD_STRENGTHS, $dbg_file; $min= $data[0][0]; $min= $data[0][0]; $max = $data[0][0]; $max = $data[0][0]; $rows = sizeof($data); $rows = sizeof($data); Loading Loading @@ -358,12 +355,17 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us $xy = $argmax; // x,y pair $xy = $argmax; // x,y pair // put a cell into a queue, in $poly_data and mark a cell as used // put a cell into a queue, in $poly_data and mark a cell as used $queue[] = $xy; $queue[] = $xy; if (! in_array($data[$xy[1]][$xy[0]], $HUGHES_BAD_STRENGTHS)) { $poly_data[] = array( $poly_data[] = array( array(0.0,0.0), // $xy, array( 0.0, 0.0 ), // $xy, array( array( $data[$xy[1]][$xy[0]] $data[$xy[1]][$xy[0]] ) ) ); ); } $cluster[$xy[1]][$xy[0]] = true; $cluster[$xy[1]][$xy[0]] = true; while (sizeof($queue) > 0) { while (sizeof($queue) > 0) { Loading Loading @@ -407,13 +409,18 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us if ($data[$xy[1]][$xy[0]] < $threshold) // signal too weak if ($data[$xy[1]][$xy[0]] < $threshold) // signal too weak continue; // already used continue; // already used $queue[] = $xy; $queue[] = $xy; $cluster[$xy[1]][$xy[0]] = true; if (! in_array($data[$xy[1]][$xy[0]], $HUGHES_BAD_STRENGTHS)) { // use for the wave, but do not use for polynimial maximum $poly_data[] = array( $poly_data[] = array( array($xy[0]-$argmax[0], $xy[1]-$argmax[1]), array( $xy[0] - $argmax[0], $xy[1] - $argmax[1] ), array( array( $data[$xy[1]][$xy[0]] $data[$xy[1]][$xy[0]] ) ) ); ); $cluster[$xy[1]][$xy[0]] = true; } } } } } if ($dbg_file !== null) { if ($dbg_file !== null) { Loading Loading @@ -495,7 +502,7 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us function findMax1d($data, $fract, $pow, $frac_outside = 0.2){ function findMax1d($data, $fract, $pow, $frac_outside = 0.2){ global $dbg_file; global $HUGHES_BAD_STRENGTHS, $dbg_file; $min= $data[0]; $min= $data[0]; $max = $data[0]; $max = $data[0]; $argmax = 0; $argmax = 0; Loading @@ -522,7 +529,12 @@ function findMax1d($data, $fract, $pow, $frac_outside = 0.2){ $poly_data = Array(); $poly_data = Array(); for ($k = $k_min; $k <= $k_max; $k++){ for ($k = $k_min; $k <= $k_max; $k++){ $poly_data[] = Array($k-$argmax, $datap[$k]); if (! in_array($datap[$k], $HUGHES_BAD_STRENGTHS)) { // skip samples with "bad" strengths (see explanation in the $HUGHES_BAD_STRENGTHS declaration $poly_data[] = Array( $k - $argmax, $datap[$k] ); } } } $pa = new PolynomialApproximation(); $pa = new PolynomialApproximation(); Loading Loading @@ -852,22 +864,34 @@ function waitMotorsReady($modem_threshold = 0.0){ // return $try; return $try; } } function moveElAzSk_counts($new_azelsk_count) { function moveElAzSk_counts($new_azelsk_count, $multi = true) { $total_cycles = 0; while (true) { $xml_state = moveElAzSk_start_counts($new_azelsk_count); $xml_state = moveElAzSk_start_counts($new_azelsk_count); if (isset($xml_state)) { if (isset($xml_state)) { $cycles = waitMotorsReady(); $cycles = waitMotorsReady(); return $cycles; // $xml_state; $total_cycles += $cycles; if (!$multi) return $total_cycles; } else return $total_cycles; // did not move last time } } return; } } function moveElAzSk_degrees($new_azelsk_degree) { function moveElAzSk_degrees($new_azelsk_degree, $multi = true) { $total_cycles = 0; while (true) { $xml_state = moveElAzSk_start_degrees($new_azelsk_degree); $xml_state = moveElAzSk_start_degrees($new_azelsk_degree); if (isset($xml_state)) { if (isset($xml_state)) { $cycles = waitMotorsReady(); $cycles = waitMotorsReady(); return $cycles; // $xml_state; $total_cycles += $cycles; if (!$multi) return $total_cycles; } else return $total_cycles; // did not move last time } } return; } } function myval ($s) { function myval ($s) { Loading