private void calculateRiseSetMethodA(GPGregorianTime vct, GPLocationProvider ed, double DayHours, GPSun sun, double DG, double RAD) { double time = vct.getJulianLocalNoon() - 0.5 + DayHours / 360 - vct.getTimeZoneOffsetHours() / 24.0; double dLatitude = ed.getLocation(time).GetLatitudeNorthPositive(); double dLongitude = ed.getLocation(time).GetLongitudeEastPositive(); //Debugger.Log(0,"",String.Format("{0} {1} {2}\n", vct.getLongDateString(), dLatitude, dLongitude)); // definition of event // eventdef = 0.0; // civil twilight eventdef = 0.10453; // nautical twilight eventdef = 0.20791; // astronomical twilight eventdef = 0.30902; // center of the sun on the horizont eventdef = 0.01454; double eventdef = 0.01454; double x = GPMath.tanDeg(dLatitude) * GPMath.tanDeg(sun.declination) + eventdef / (GPMath.cosDeg(dLatitude) * GPMath.cosDeg(sun.declination)); if (x < -1.0 || x > 1.0) { // initial values for the case // that no rise no set for that day sun.sunrise_deg = -360; sun.noon_deg = -360; sun.sunset_deg = -360; return; } double hourAngle = GPMath.arcsinDeg(x); // time of sunrise sun.sunrise_deg = 90.0 - dLongitude - hourAngle + equationOfTime; // time of noon sun.noon_deg = 180.0 - dLongitude + equationOfTime; // time of sunset sun.sunset_deg = 270.0 - dLongitude + hourAngle + equationOfTime; }
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 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); }