« lib/Astro/Montenbruck/Ephemeris/Planet/Saturn.pm
↑ Summary
lib/Astro/Montenbruck/Ephemeris/Planet/Uranus.pm »
| 1 | package Astro::Montenbruck::Ephemeris::Planet::Sun; | ||
| 2 | |||
| 3 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 6 | ▶ | use base qw/Astro::Montenbruck::Ephemeris::Planet/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 6 | ▶ | use Math::Trig qw/:pi rad2deg deg2rad/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 6 | ▶ | use Astro::Montenbruck::MathUtils qw /frac ARCS reduce_rad cart polar/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 6 | ▶ | use Astro::Montenbruck::Ephemeris::Pert qw/pert/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 6 | ▶ | use Astro::Montenbruck::Ephemeris::Planet qw/$SU/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 6 | our $VERSION = 0.01; | |
| 13 | |||
| 14 | 687 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 15 | 687 | my $class = shift; | |
| 16 | 687 | $class->SUPER::new( id => $SU ); | |
| 17 | } | ||
| 18 | |||
| 19 | 704 | ▶ | sub sunpos { |
|
Subroutine
sunpos: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | 704 | my ( $self, $t ) = @_; | |
| 21 | |||
| 22 | # mean anomalies of planets and mean arguments of lunar orbit [rad] | ||
| 23 | 704 | my $m2 = pi2 * frac( 0.1387306 + 162.5485917 * $t ); | |
| 24 | 704 | my $m3 = pi2 * frac( 0.9931266 + 99.9973604 * $t ); | |
| 25 | 704 | my $m4 = pi2 * frac( 0.0543250 + 53.1666028 * $t ); | |
| 26 | 704 | my $m5 = pi2 * frac( 0.0551750 + 8.4293972 * $t ); | |
| 27 | 704 | my $m6 = pi2 * frac( 0.8816500 + 3.3938722 * $t ); | |
| 28 | |||
| 29 | 704 | my $d = pi2 * frac( 0.8274 + 1236.8531 * $t ); | |
| 30 | 704 | my $a = pi2 * frac( 0.3749 + 1325.5524 * $t ); | |
| 31 | 704 | my $u = pi2 * frac( 0.2591 + 1342.2278 * $t ); | |
| 32 | |||
| 33 | 704 | my ( $dl, $dr, $db ) = ( 0, 0, 0 ); # Corrections in longitude ["], | |
| 34 | 704 | ▶ | my $pert_cb = sub { $dl += $_[0]; $dr += $_[1]; $db += $_[2] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 35 | |||
| 36 | # Keplerian terms and perturbations by Venus | ||
| 37 | 704 | my $term = pert( | |
| 38 | T => $t, | ||
| 39 | M => $m3, | ||
| 40 | m => $m2, | ||
| 41 | I_min => 0, | ||
| 42 | I_max => 7, | ||
| 43 | i_min => -6, | ||
| 44 | i_max => 0, | ||
| 45 | callback => $pert_cb | ||
| 46 | ); | ||
| 47 | |||
| 48 | 704 | $term->( 1, 0, 0, -0.22, 6892.76, -16707.37, -0.54, 0, 0 ); | |
| 49 | 704 | $term->( 1, 0, 1, -0.06, -17.35, 42.04, -0.15, 0.00, 0.00 ); | |
| 50 | 704 | $term->( 1, 0, 2, -0.01, -0.05, 0.13, -0.02, 0.00, 0.00 ); | |
| 51 | 704 | $term->( 2, 0, 0, 0.00, 71.98, -139.57, 0.00, 0.00, 0.00 ); | |
| 52 | 704 | $term->( 2, 0, 1, 0.00, -0.36, 0.70, 0.00, 0.00, 0.00 ); | |
| 53 | 704 | $term->( 3, 0, 0, 0.00, 1.04, -1.75, 0.00, 0.00, 0.00 ); | |
| 54 | 704 | $term->( 0, -1, 0, 0.03, -0.07, -0.16, -0.07, 0.02, -0.02 ); | |
| 55 | 704 | $term->( 1, -1, 0, 2.35, -4.23, -4.75, -2.64, 0.00, 0.00 ); | |
| 56 | 704 | $term->( 1, -2, 0, -0.10, 0.06, 0.12, 0.20, 0.02, 0.00 ); | |
| 57 | 704 | $term->( 2, -1, 0, -0.06, -0.03, 0.20, -0.01, 0.01, -0.09 ); | |
| 58 | 704 | $term->( 2, -2, 0, -4.70, 2.90, 8.28, 13.42, 0.01, -0.01 ); | |
| 59 | 704 | $term->( 3, -2, 0, 1.80, -1.74, -1.44, -1.57, 0.04, -0.06 ); | |
| 60 | 704 | $term->( 3, -3, 0, -0.67, 0.03, 0.11, 2.43, 0.01, 0.00 ); | |
| 61 | 704 | $term->( 4, -2, 0, 0.03, -0.03, 0.10, 0.09, 0.01, -0.01 ); | |
| 62 | 704 | $term->( 4, -3, 0, 1.51, -0.40, -0.88, -3.36, 0.18, -0.10 ); | |
| 63 | 704 | $term->( 4, -4, 0, -0.19, -0.09, -0.38, 0.77, 0.00, 0.00 ); | |
| 64 | 704 | $term->( 5, -3, 0, 0.76, -0.68, 0.30, 0.37, 0.01, 0.00 ); | |
| 65 | 704 | $term->( 5, -4, 0, -0.14, -0.04, -0.11, 0.43, -0.03, 0.00 ); | |
| 66 | 704 | $term->( 5, -5, 0, -0.05, -0.07, -0.31, 0.21, 0.00, 0.00 ); | |
| 67 | 704 | $term->( 6, -4, 0, 0.15, -0.04, -0.06, -0.21, 0.01, 0.00 ); | |
| 68 | 704 | $term->( 6, -5, 0, -0.03, -0.03, -0.09, 0.09, -0.01, 0.00 ); | |
| 69 | 704 | $term->( 6, -6, 0, 0.00, -0.04, -0.18, 0.02, 0.00, 0.00 ); | |
| 70 | 704 | $term->( 7, -5, 0, -0.12, -0.03, -0.08, 0.31, -0.02, -0.01 ); | |
| 71 | |||
| 72 | # perturbations by Mars | ||
| 73 | 704 | $term = pert( | |
| 74 | T => $t, | ||
| 75 | M => $m3, | ||
| 76 | m => $m4, | ||
| 77 | I_min => 1, | ||
| 78 | I_max => 5, | ||
| 79 | i_min => -8, | ||
| 80 | i_max => -1, | ||
| 81 | callback => $pert_cb | ||
| 82 | ); | ||
| 83 | 704 | $term->( 1, -1, 0, -0.22, 0.17, -0.21, -0.27, 0.00, 0.00 ); | |
| 84 | 704 | $term->( 1, -2, 0, -1.66, 0.62, 0.16, 0.28, 0.00, 0.00 ); | |
| 85 | 704 | $term->( 2, -2, 0, 1.96, 0.57, -1.32, 4.55, 0.00, 0.01 ); | |
| 86 | 704 | $term->( 2, -3, 0, 0.40, 0.15, -0.17, 0.46, 0.00, 0.00 ); | |
| 87 | 704 | $term->( 2, -4, 0, 0.53, 0.26, 0.09, -0.22, 0.00, 0.00 ); | |
| 88 | 704 | $term->( 3, -3, 0, 0.05, 0.12, -0.35, 0.15, 0.00, 0.00 ); | |
| 89 | 704 | $term->( 3, -4, 0, -0.13, -0.48, 1.06, -0.29, 0.01, 0.00 ); | |
| 90 | 704 | $term->( 3, -5, 0, -0.04, -0.20, 0.20, -0.04, 0.00, 0.00 ); | |
| 91 | 704 | $term->( 4, -4, 0, 0.00, -0.03, 0.10, 0.04, 0.00, 0.00 ); | |
| 92 | 704 | $term->( 4, -5, 0, 0.05, -0.07, 0.20, 0.14, 0.00, 0.00 ); | |
| 93 | 704 | $term->( 4, -6, 0, -0.10, 0.11, -0.23, -0.22, 0.00, 0.00 ); | |
| 94 | 704 | $term->( 5, -7, 0, -0.05, 0.00, 0.01, -0.14, 0.00, 0.00 ); | |
| 95 | 704 | $term->( 5, -8, 0, 0.05, 0.01, -0.02, 0.10, 0.00, 0.00 ); | |
| 96 | |||
| 97 | # perturbations by Sun | ||
| 98 | 704 | $term = pert( | |
| 99 | T => $t, | ||
| 100 | M => $m3, | ||
| 101 | m => $m5, | ||
| 102 | I_min => -1, | ||
| 103 | I_max => 3, | ||
| 104 | i_min => -4, | ||
| 105 | i_max => -1, | ||
| 106 | callback => $pert_cb | ||
| 107 | ); | ||
| 108 | 704 | $term->( -1, -1, 0, 0.01, 0.07, 0.18, -0.02, 0.00, -0.02 ); | |
| 109 | 704 | $term->( 0, -1, 0, -0.31, 2.58, 0.52, 0.34, 0.02, 0.00 ); | |
| 110 | 704 | $term->( 1, -1, 0, -7.21, -0.06, 0.13, -16.27, 0.00, -0.02 ); | |
| 111 | 704 | $term->( 1, -2, 0, -0.54, -1.52, 3.09, -1.12, 0.01, -0.17 ); | |
| 112 | 704 | $term->( 1, -3, 0, -0.03, -0.21, 0.38, -0.06, 0.00, -0.02 ); | |
| 113 | 704 | $term->( 2, -1, 0, -0.16, 0.05, -0.18, -0.31, 0.01, 0.00 ); | |
| 114 | 704 | $term->( 2, -2, 0, 0.14, -2.73, 9.23, 0.48, 0.00, 0.00 ); | |
| 115 | 704 | $term->( 2, -3, 0, 0.07, -0.55, 1.83, 0.25, 0.01, 0.00 ); | |
| 116 | 704 | $term->( 2, -4, 0, 0.02, -0.08, 0.25, 0.06, 0.00, 0.00 ); | |
| 117 | 704 | $term->( 3, -2, 0, 0.01, -0.07, 0.16, 0.04, 0.00, 0.00 ); | |
| 118 | 704 | $term->( 3, -3, 0, -0.16, -0.03, 0.08, -0.64, 0.00, 0.00 ); | |
| 119 | 704 | $term->( 3, -4, 0, -0.04, -0.01, 0.03, -0.17, 0.00, 0.00 ); | |
| 120 | |||
| 121 | # perturbations by Saturn | ||
| 122 | 704 | $term = pert( | |
| 123 | T => $t, | ||
| 124 | M => $m3, | ||
| 125 | m => $m6, | ||
| 126 | I_min => -0, | ||
| 127 | I_max => 2, | ||
| 128 | i_min => -2, | ||
| 129 | i_max => -1, | ||
| 130 | callback => $pert_cb | ||
| 131 | ); | ||
| 132 | 704 | $term->( 0, -1, 0, 0.00, 0.32, 0.01, 0.00, 0.00, 0.00 ); | |
| 133 | 704 | $term->( 1, -1, 0, -0.08, -0.41, 0.97, -0.18, 0.00, -0.01 ); | |
| 134 | 704 | $term->( 1, -2, 0, 0.04, 0.10, -0.23, 0.10, 0.00, 0.00 ); | |
| 135 | 704 | $term->( 2, -2, 0, 0.04, 0.10, -0.35, 0.13, 0.00, 0.00 ); | |
| 136 | |||
| 137 | # difference of Earth-Moon-barycentre and centre of the Earth | ||
| 138 | 704 | my $dpa = $d + $a; | |
| 139 | 704 | my $dma = $d - $a; | |
| 140 | 704 | $dl += | |
| 141 | +6.45 * sin($d) - | ||
| 142 | 0.42 * sin($dma) + | ||
| 143 | 0.18 * sin($dpa) + | ||
| 144 | 0.17 * sin( $d - $m3 ) - | ||
| 145 | 0.06 * sin( $d + $m3 ); | ||
| 146 | |||
| 147 | 704 | $dr += | |
| 148 | +30.76 * cos($d) - | ||
| 149 | 3.06 * cos($dma) + | ||
| 150 | 0.85 * cos($dpa) - | ||
| 151 | 0.58 * cos( $d + $m3 ) + | ||
| 152 | 0.57 * cos( $d - $m3 ); | ||
| 153 | |||
| 154 | 704 | $db += 0.576 * sin($u); | |
| 155 | |||
| 156 | # long-periodic perturbations | ||
| 157 | 704 | $dl += | |
| 158 | +6.40 * sin( pi2 * ( 0.6983 + 0.0561 * $t ) ) + | ||
| 159 | 1.87 * sin( pi2 * ( 0.5764 + 0.4174 * $t ) ) + | ||
| 160 | 0.27 * sin( pi2 * ( 0.4189 + 0.3306 * $t ) ) + | ||
| 161 | 0.20 * sin( pi2 * ( 0.3581 + 2.4814 * $t ) ); | ||
| 162 | |||
| 163 | # ecliptic coordinates ([rad],[AU]) | ||
| 164 | 704 | my $l = reduce_rad( | |
| 165 | pi2 * frac( | ||
| 166 | 0.7859453 + $m3 / pi2 + | ||
| 167 | ( ( 6191.2 + 1.1 * $t ) * $t + $dl ) / 1296.0e3 | ||
| 168 | ) | ||
| 169 | ); | ||
| 170 | 704 | my $r = 1.0001398 - 0.0000007 * $t + $dr * 1e-6; | |
| 171 | 704 | my $b = $db / 3600; | |
| 172 | |||
| 173 | 704 | rad2deg($l), $b, $r; | |
| 174 | } | ||
| 175 | |||
| 176 | |||
| 177 | 465 | ▶ | sub _lbr_geo { 0, 0, 0 } |
|
Subroutine
_lbr_geo: called CC=1 SCAR=0.0
| |||
| 178 | |||
| 179 | |||
| 180 | 465 | ▶ | sub apparent { |
|
Subroutine
apparent: called CC=1 SCAR=0.0
Pod
documented
| |||
| 181 | 465 | my $self = shift; | |
| 182 | 465 | my ($t, $lbr, $nut_func) = @_; | |
| 183 | 465 | my ($l, $b, $r) = @$lbr; | |
| 184 | # geocentric ecliptic coordinates (light-time corrected, referred to the mean equinox of date) | ||
| 185 | 465 | my @mean = $self->_geocentric( | |
| 186 | $t, | ||
| 187 | { l => 0, b => 0, r => 0 }, | ||
| 188 | { l => deg2rad($l), b => deg2rad($b), r => $r } | ||
| 189 | ); | ||
| 190 | # true equinox of date | ||
| 191 | 465 | my @date = $nut_func->(\@mean); | |
| 192 | # rectangular -> polar | ||
| 193 | 465 | ($r, $b, $l) = polar(@date); | |
| 194 | 465 | rad2deg($l), rad2deg($b), $r | |
| 195 | } | ||
| 196 | |||
| 197 | |||
| 198 | 6 | 1; | |
| 199 | |||
| 200 | __END__ | ||