Astro-satpass
view release on metacpan or search on metacpan
geodetic( deg2rad( -40 ), deg2rad( 105 ), 0 )->eci( $time );
tolerance_frac( $x, -1703.295, 1e-6, 'Geodetic to ECI: X' );
tolerance_frac( $y, -4586.650, 1e-6, 'Geodetic to ECI: Y' );
tolerance_frac( $z, -4077.984, 1e-6, 'Geodetic to ECI: Z' );
}
# eci -> geodetic
# Tests: eci() (and geodetic() and geocentric())
# This is the reverse of the previous test.
{
my $time = greg_time_gm( 0, 0, 9, 1, 9, 1995 );
my ( $lat, $long, $elev ) =
Astro::Coord::ECI->new( ellipsoid => 'WGS72' )->
eci( 1703.295, 4586.650, 4077.984, $time )->geodetic();
tolerance_frac( $lat, deg2rad( 40 ), 1e-6,
'ECI to geodetic: latitude' );
tolerance_frac( $long, deg2rad( -75 ), 1e-6,
'ECI to geodetic: longitude' );
$elev += EQUATORIALRADIUS;
tolerance_frac( $elev, EQUATORIALRADIUS, 1e-6,
'ECI to geodetic: distance from center' );
$time = greg_time_gm( 0, 0, 9, 1, 9, 1995 );
( $lat, $long, $elev ) =
Astro::Coord::ECI->new( ellipsoid => 'WGS72' )->
eci( -1703.295, -4586.650, -4077.984, $time )->geodetic();
tolerance_frac( $lat, deg2rad( -40 ), 1e-6,
'ECI to geodetic: latitude' );
tolerance_frac( $long, deg2rad( 105 ), 1e-6,
'ECI to geodetic: longitude' );
$elev += EQUATORIALRADIUS;
tolerance_frac( $elev, EQUATORIALRADIUS, 1e-6,
'ECI to geodetic: distance from center' );
}
# azel
# Tests: azel() (and geodetic(), geocentric(), and eci())
# Book solution from
# http://www.satcom.co.uk/article.asp?article=1
note <<'EOD';
In the following three tests the tolerance is degraded because the
book solution is calculated by http://www.satcom.co.uk/article.asp?article=1
which apparently assumes an exactly synchronous orbit. Their exact
altitude assumption is undocumented, as is their algorithm. So the
tests are really more of a sanity check.
EOD
{
my $time = greg_time_gm( 0, 0, 5, 27, 7, 2005 );
my $sta = Astro::Coord::ECI->new( ellipsoid => 'GRS80' )->
geodetic( deg2rad( 38 ), deg2rad( -80 ), 1 );
my $sat = Astro::Coord::ECI->new( ellipsoid => 'GRS80' )->
universal( $time )->
geodetic( deg2rad( 0 ), deg2rad( -75 ), 35800 );
my ( $azm, $elev, $rng ) = $sta->azel( $sat );
tolerance_frac( $azm, deg2rad( 171.906 ), 1e-3,
'Azimuth for observer' );
tolerance_frac( $elev, deg2rad( 45.682 ), 1e-3,
'Elevation for observer' );
tolerance_frac( $rng, 37355.457, 1e-3,
'Range for observer' );
# Same as above tests, but with the station in the 'station'
# attribute.
$sat->set( station => $sta );
( $azm, $elev, $rng ) = $sat->azel();
tolerance_frac( $azm, deg2rad( 171.906 ), 1e-3,
'Azimuth for observer' );
tolerance_frac( $elev, deg2rad( 45.682 ), 1e-3,
'Elevation for observer' );
tolerance_frac( $rng, 37355.457, 1e-3,
'Range for observer' );
# enu
# Tests: enu()
# From the azel() test above, converted as described at
# http://geostarslib.sourceforge.net/main.html#conv
my ( $East, $North, $Up ) = $sat->enu();
tolerance( $East, 3675, 10,
'East for observer' );
tolerance( $North, -25840, 10,
'North for observer' );
tolerance( $Up, 26746, 10,
'Up for observer' );
}
# atmospheric refraction.
# Tests: correct_for_refraction()
( run in 1.332 second using v1.01-cache-2.11-cpan-d8267643d1d )