public void calculateCoordinatesMethodC(GPGregorianTime vct, double DayHours) { double DG = GPMath.pi / 180; double RAD = 180 / GPMath.pi; // mean ecliptic longitude of the sun double mel = SunGetMeanLong(vct.getYear(), vct.getMonth(), vct.getDay()) + (360 / 365.25) * DayHours / 360.0; // ecliptic longitude of perigee double elp = SunGetPerigee(vct.getYear(), vct.getMonth(), vct.getDay()); // mean anomaly of the sun double M = mel - elp; // equation of center double C = 1.9148 * GPMath.sinDeg(M) + 0.02 * GPMath.sinDeg(2 * M) + 0.0003 * GPMath.sinDeg(3 * M); // ecliptic longitude of the sun double els = 0; eclipticalLongitude = els = mel + C; // declination of the sun declination = GPMath.arcsinDeg(0.397948 * GPMath.sinDeg(eclipticalLongitude)); // right ascension of the sun rightAscession = els - RAD * Math.Atan2(Math.Sin(2 * els * DG), 23.2377 + Math.Cos(2 * DG * els)); // equation of time equationOfTime = rightAscession - mel; //equationOfTime = GPAstroEngine.getEquationOfTime(julianDay, right_asc_deg); //Debugger.Log(0,"", String.Format("{1}: EoTdiff = {0}\n", vct.getShortDateString(), equationOfTime - (right_asc_deg - mel))); }
/// <summary> /// Based on Chapter 39, Meeus and Chapter 10 /// </summary> /// <param name="obs"></param> public void makeTopocentric(GPObserver obs) { double u, h, delta_alpha; double rho_sin, rho_cos; const double b_a = 0.99664719; // geocentric position of observer on the earth surface // 10.1 - 10.3 u = GPMath.arctanDeg(b_a * b_a * GPMath.tanDeg(obs.GetLatitudeNorthPositive())); rho_sin = b_a * GPMath.sinDeg(u) + obs.GetAltitude() / 6378140.0 * GPMath.sinDeg(obs.GetLatitudeNorthPositive()); rho_cos = GPMath.cosDeg(u) + obs.GetAltitude() / 6378140.0 * GPMath.cosDeg(obs.GetLatitudeNorthPositive()); // equatorial horizontal paralax // 39.1 this.parallax = GPMath.arcsinDeg(GPMath.sinDeg(8.794 / 3600) / (this.distanceFromEarth / GPAstroEngine.AU)); // geocentric hour angle of the body h = apparent_sidereal_time - obs.GetLongitudeWestPositive() - right_ascession; // 39.2 delta_alpha = GPMath.arctanDeg( (-rho_cos * GPMath.sinDeg(this.parallax) * GPMath.sinDeg(h)) / (GPMath.cosDeg(this.declination) - rho_cos * GPMath.sinDeg(this.parallax) * GPMath.cosDeg(h))); this.right_ascession += delta_alpha; this.declination = GPMath.arctanDeg( ((GPMath.sinDeg(this.declination) - rho_sin * GPMath.sinDeg(this.parallax)) * GPMath.cosDeg(delta_alpha)) / (GPMath.cosDeg(this.declination) - rho_cos * GPMath.sinDeg(this.parallax) * GPMath.cosDeg(h))); }
public static void calc_geocentric(ref double longitude, ref double latitude, ref double rektaszension, ref double declination, double date) { //var double epsilon; //: extended; double delta_phi; //: extended; double alpha, delta; //: extended; calc_epsilon_phi(date, out delta_phi, out epsilon); longitude = GPMath.putIn360(longitude + delta_phi); alpha = GPMath.arctan2Deg(GPMath.sinDeg(longitude) * GPMath.cosDeg(epsilon) - GPMath.tanDeg(latitude) * GPMath.sinDeg(epsilon), GPMath.cosDeg(longitude)); delta = GPMath.arcsinDeg(GPMath.sinDeg(latitude) * GPMath.cosDeg(epsilon) + GPMath.cosDeg(latitude) * GPMath.sinDeg(epsilon) * GPMath.sinDeg(longitude)); rektaszension = alpha; declination = delta; double xg, yg, zg; xg = GPMath.cosDeg(longitude) * GPMath.cosDeg(latitude); yg = GPMath.sinDeg(longitude) * GPMath.cosDeg(latitude); zg = GPMath.sinDeg(latitude); alpha = GPMath.arctan2Deg(yg * GPMath.cosDeg(epsilon) - zg * GPMath.sinDeg(epsilon), GPMath.cosDeg(longitude) * GPMath.cosDeg(latitude)); }
public void calculateCoordinatesMethodM(double julian) { double DG = GPMath.rads; double RAD = 180 / GPMath.pi; double t = (julian - 2451545.0) / 36525; double t2 = t * t; double t3 = t2 * t; double t4 = t2 * t2; // mean ecliptic longitude of the sun double L0 = 280.4664567 + 36000.76982779 * t + 0.0003032028 * t2 + t3 / 49931000; // mean anomaly of the sun double M = 357.5291 + 35999.05030 * t - 0.0001559 * t2 - 0.00000048 * t3; L0 = GPMath.putIn360(L0); M = GPMath.putIn360(M); sunMeanAnomaly = M; double C = (1.9146 - 0.004817 * t - 0.000014 * t2) * GPMath.sinDeg(M) + (0.019993 - 0.000101 * t) * GPMath.sinDeg(2 * M) + 0.00029 * GPMath.sinDeg(3 * M); sunEquationCenter = C; // ecliptic longitude of the sun //double els = 0; eclipticalLongitude = GPMath.putIn360(L0 + C); double e = 0.016708617 - 0.000042037 * t - 0.0000001236 * t2; double trueAnomaly = M + C; // double epsilon; // double deltaPhi; // GPAstroEngine.calc_epsilon_phi(julianDay, out deltaPhi, out epsilon); // = 23.4391 - 0.013 * t - t2/6101694; double omega = 125.04 - 1934.136 * t; double lambda = eclipticalLongitude - 0.00569 - 0.00478 * GPMath.sinDeg(omega); double epsilon0 = 23.4392911 - 0.01300416 * t - 1.638e-7 * t2; double epsilon1 = epsilon0 + 0.00256 * GPMath.cosDeg(omega); // right ascension of the sun this.rightAscession = RAD * Math.Atan2(GPMath.cosDeg(epsilon1) * GPMath.sinDeg(lambda), GPMath.cosDeg(lambda)); this.rightAscession = GPMath.putIn360(rightAscession); // declination of the sun this.declination = GPMath.arcsinDeg(GPMath.sinDeg(epsilon1) * GPMath.sinDeg(lambda)); // equation of time equationOfTime = GPAstroEngine.getEquationOfTime(julian, this.rightAscession); }
private void calculateRiseSetMethodM(double D, GPLocationProvider ed) { GPLocation obs = ed.getLocation(D); double a1, a2, a3; double d1, d2, d3; double siderealTime = GPAstroEngine.GetSiderealTime(D); double h0 = -0.833333; calculateCoordinatesMethodM(D - 1); a1 = rightAscession; d1 = declination; calculateCoordinatesMethodM(D); a2 = rightAscession; d2 = declination; calculateCoordinatesMethodM(D + 1); a3 = rightAscession; d3 = declination; double longitude = -ed.GetLongitudeEastPositive(); double latitude = ed.GetLatitudeNorthPositive(); double cosH0 = (GPMath.sinDeg(h0) - GPMath.sinDeg(latitude) * GPMath.sinDeg(d2)) / (GPMath.cosDeg(latitude) * GPMath.cosDeg(d2)); double H0 = GPMath.arccosDeg(cosH0); H0 = GPMath.putIn180(H0); double m0 = (a2 + longitude - siderealTime) / 360; double m1 = m0 - H0 / 360; double m2 = m0 + H0 / 360; double deltaM = 0; deltaM = getCorrection(D, a1, a2, a3, d1, d2, d3, siderealTime, h0, longitude, latitude, m0, true); m0 += deltaM; deltaM = getCorrection(D, a1, a2, a3, d1, d2, d3, siderealTime, h0, longitude, latitude, m1, false); m1 += deltaM; deltaM = getCorrection(D, a1, a2, a3, d1, d2, d3, siderealTime, h0, longitude, latitude, m2, false); m2 += deltaM; julianDayRise = julianDay + m1; julianDayNoon = julianDay + m0; julianDaySet = julianDay + m2; sunrise_deg = GPMath.putIn360(m1 * 360); noon_deg = GPMath.putIn360(m0 * 360); sunset_deg = GPMath.putIn360(m2 * 360); }
private static double getCorrection(double D, double a1, double a2, double a3, double d1, double d2, double d3, double siderealTime, double h0, double longitude, double latitude, double m0, bool transit) { double deltaM = 0; double PHI = siderealTime + 360.985647 * m0; double n = m0 + GPDynamicTime.GetDeltaT(D) / 86400; double alpha = GPAstroEngine.interpolation(a1, a2, a3, n); double delta = GPAstroEngine.interpolation(d1, d2, d3, n); double H = GPMath.putIn180(PHI - longitude - alpha); double h = 0; if (transit) { deltaM = -H / 360; } else { double sinH = GPMath.sinDeg(latitude) * GPMath.sinDeg(delta) + GPMath.cosDeg(latitude) * GPMath.cosDeg(delta) * GPMath.cosDeg(H); h = GPMath.arcsinDeg(sinH); deltaM = (h - h0) / (360 * GPMath.cosDeg(delta) * GPMath.cosDeg(latitude) * GPMath.sinDeg(H)); } return(deltaM); }