public static Epsilon Calc(JulianDayNumber J, SEFLG iflag, SweData swed) { var prec_model = swed.LongtermPrecessionMode; var prec_model_short = swed.ShorttermPrecessionMode; var jplhora_model = swed.JplHorizonsMode; bool is_jplhor = false; if (iflag.HasFlag(SEFLG.JPLHOR)) { is_jplhor = true; } if (iflag.HasFlag(SEFLG.JPLHOR_APPROX) && jplhora_model == JplHorizonsMode.Three && J <= HORIZONS_TJD0_DPSI_DEPS_IAU1980) { is_jplhor = true; } double T = (J - JulianDayNumber.J2000).Raw / 36525.0; double eps; if (is_jplhor) { if (J > JulianDayNumber.J1799_01_01 && J < JulianDayNumber.J2202_01_01) { // between 1.1.1799 and 1.1.2202 eps = (((1.813e-3 * T - 5.9e-4) * T - 46.8150) * T + 84381.448) * DEGTORAD / 3600; } else { eps = OwenPrecession.epsiln_owen_1986(J); eps *= DEGTORAD; } } else if (iflag.HasFlag(SEFLG.JPLHOR_APPROX) && jplhora_model == JplHorizonsMode.Two) { eps = (((1.813e-3 * T - 5.9e-4) * T - 46.8150) * T + 84381.448) * DEGTORAD / 3600; } else if (prec_model_short == PrecessionModel.IAU_1976 && Math.Abs(T) <= PREC_IAU_1976_CTIES) { eps = (((1.813e-3 * T - 5.9e-4) * T - 46.8150) * T + 84381.448) * DEGTORAD / 3600; } else if (prec_model == PrecessionModel.IAU_1976) { eps = (((1.813e-3 * T - 5.9e-4) * T - 46.8150) * T + 84381.448) * DEGTORAD / 3600; } else if (prec_model_short == PrecessionModel.IAU_2000 && Math.Abs(T) <= PREC_IAU_2000_CTIES) { eps = (((1.813e-3 * T - 5.9e-4) * T - 46.84024) * T + 84381.406) * DEGTORAD / 3600; } else if (prec_model == PrecessionModel.IAU_2000) { eps = (((1.813e-3 * T - 5.9e-4) * T - 46.84024) * T + 84381.406) * DEGTORAD / 3600; } else if (prec_model_short == PrecessionModel.IAU_2006 && Math.Abs(T) <= PREC_IAU_2006_CTIES) { eps = (((((-4.34e-8 * T - 5.76e-7) * T + 2.0034e-3) * T - 1.831e-4) * T - 46.836769) * T + 84381.406) * DEGTORAD / 3600.0; } else if (prec_model == PrecessionModel.IAU_2006) { eps = (((((-4.34e-8 * T - 5.76e-7) * T + 2.0034e-3) * T - 1.831e-4) * T - 46.836769) * T + 84381.406) * DEGTORAD / 3600.0; } else if (prec_model == PrecessionModel.BRETAGNON_2003) { eps = ((((((-3e-11 * T - 2.48e-8) * T - 5.23e-7) * T + 1.99911e-3) * T - 1.667e-4) * T - 46.836051) * T + 84381.40880) * DEGTORAD / 3600.0; } else if (prec_model == PrecessionModel.SIMON_1994) { eps = (((((2.5e-8 * T - 5.1e-7) * T + 1.9989e-3) * T - 1.52e-4) * T - 46.80927) * T + 84381.412) * DEGTORAD / 3600.0; /* */ } else if (prec_model == PrecessionModel.WILLIAMS_1994) { eps = ((((-1.0e-6 * T + 2.0e-3) * T - 1.74e-4) * T - 46.833960) * T + 84381.409) * DEGTORAD / 3600.0; /* */ } else if (prec_model == PrecessionModel.LASKAR_1986 || prec_model == PrecessionModel.WILL_EPS_LASK) { T /= 10.0; eps = (((((((((2.45e-10 * T + 5.79e-9) * T + 2.787e-7) * T + 7.12e-7) * T - 3.905e-5) * T - 2.4967e-3) * T - 5.138e-3) * T + 1.99925) * T - 0.0155) * T - 468.093) * T + 84381.448; eps *= DEGTORAD / 3600.0; } else if (prec_model == PrecessionModel.OWEN_1990) { eps = OwenPrecession.epsiln_owen_1986(J); eps *= DEGTORAD; } else { /* SEMOD_PREC_VONDRAK_2011 */ (_, eps) = Vondrak.swi_ldp_peps(J); if (iflag.HasFlag(SEFLG.JPLHOR_APPROX) && jplhora_model != JplHorizonsMode.Two) { double tofs = (J - DCOR_EPS_JPL_TJD0).Raw / 365.25; double dofs; if (tofs < 0) { dofs = dcor_eps_jpl[0]; } else if (tofs >= dcor_eps_jpl.Length) { dofs = dcor_eps_jpl.Last(); } else { int t0 = (int)tofs; int t1 = t0 + 1; dofs = (tofs - t0) * (dcor_eps_jpl[t0] - dcor_eps_jpl[t1]) + dcor_eps_jpl[t0]; } dofs /= (1000.0 * 3600.0); eps += dofs * DEGTORAD; } } return(new Epsilon(J, eps)); }
/// <see cref="plaus_iflag" /> public static SEFLG PlausIflag(this SEFLG iflag, SweData swed, PlanetNumber ipl) { var epheflag = SEFLG.None; // either Horizons mode or simplified Horizons mode, not both if (iflag.HasFlag(SEFLG.JPLHOR)) { iflag &= ~SEFLG.JPLHOR_APPROX; } // if topocentric bit, turn helio- and barycentric bits off; if (iflag.HasFlag(SEFLG.TOPOCTR)) { iflag &= ~(SEFLG.HELCTR | SEFLG.BARYCTR); } /* if barycentric bit, turn heliocentric bit off */ if (iflag.HasFlag(SEFLG.BARYCTR)) { iflag &= ~SEFLG.HELCTR; } /* if heliocentric bit, turn aberration and deflection off */ if (iflag.HasFlag(SEFLG.HELCTR)) { iflag |= SEFLG.NOABERR | SEFLG.NOGDEFL; /*iflag |= SEFLG.TRUEPOS;*/ } /* same, if barycentric bit */ if (iflag.HasFlag(SEFLG.BARYCTR)) { iflag |= SEFLG.NOABERR | SEFLG.NOGDEFL; /*iflag |= SEFLG.TRUEPOS;*/ } /* if no_precession bit is set, set also no_nutation bit */ if (iflag.HasFlag(SEFLG.J2000)) { iflag |= SEFLG.NONUT; } /* if sidereal bit is set, set also no_nutation bit * * also turn JPL Horizons mode off */ if (iflag.HasFlag(SEFLG.SIDEREAL)) { iflag |= SEFLG.NONUT; iflag &= ~(SEFLG.JPLHOR | SEFLG.JPLHOR_APPROX); } /* if truepos is set, turn off grav. defl. and aberration */ if (iflag.HasFlag(SEFLG.TRUEPOS)) { iflag |= SEFLG.NOGDEFL | SEFLG.NOABERR; } if (iflag.HasFlag(SEFLG.MOSEPH)) { epheflag = SEFLG.MOSEPH; } if (iflag.HasFlag(SEFLG.SWIEPH)) { epheflag = SEFLG.SWIEPH; } if (iflag.HasFlag(SEFLG.JPLEPH)) { epheflag = SEFLG.JPLEPH; } if (epheflag == SEFLG.None) { epheflag = SEFLG.DEFAULTEPH; } iflag = (iflag & ~SEFLG.EPHMASK) | epheflag; /* SEFLG.JPLHOR only with JPL and Swiss Ephemeeris */ if (!epheflag.HasFlag(SEFLG.JPLEPH)) { iflag &= ~(SEFLG.JPLHOR | SEFLG.JPLHOR_APPROX); } /* planets that have no JPL Horizons mode */ if (ipl == PlanetNumber.OsculatingApogee || ipl == PlanetNumber.TrueNode || ipl == PlanetNumber.MeanApogee || ipl == PlanetNumber.MeanNode || ipl == PlanetNumber.InterpolatedApogee || ipl == PlanetNumber.InterpolatedPerigee) { iflag &= ~(SEFLG.JPLHOR | SEFLG.JPLHOR_APPROX); } if (ipl >= PlanetNumber.FictionalOffset && ipl <= PlanetNumber.MaxFinctionalPlanetNumber) { iflag &= ~(SEFLG.JPLHOR | SEFLG.JPLHOR_APPROX); } if (iflag.HasFlag(SEFLG.JPLHOR)) { if (false) // swed.eop_dpsi_loaded <= 0 { iflag &= ~SEFLG.JPLHOR; iflag |= SEFLG.JPLHOR_APPROX; } } if (iflag.HasFlag(SEFLG.JPLHOR)) { iflag |= SEFLG.ICRS; } if (iflag.HasFlag(SEFLG.JPLHOR_APPROX) && swed.JplHorizonsMode == JplHorizonsMode.Two) { iflag |= SEFLG.ICRS; } return(iflag); }