public GCEquatorialCoords getTopocentricEquatorial(GCEarthData obs, double jdate) { double u, h, delta_alpha; double rho_sin, rho_cos; const double b_a = 0.99664719; GCEquatorialCoords tec = new GCEquatorialCoords(); double altitude = 0; // geocentric position of observer on the earth surface // 10.1 - 10.3 u = GCMath.arcTanDeg(b_a * b_a * GCMath.tanDeg(obs.latitudeDeg)); rho_sin = b_a * GCMath.sinDeg(u) + altitude / 6378140.0 * GCMath.sinDeg(obs.latitudeDeg); rho_cos = GCMath.cosDeg(u) + altitude / 6378140.0 * GCMath.cosDeg(obs.latitudeDeg); // equatorial horizontal paralax // 39.1 double parallax = GCMath.arcSinDeg(GCMath.sinDeg(8.794 / 3600) / (radius / GCMath.AU)); // geocentric hour angle of the body h = GCEarthData.SiderealTimeGreenwich(jdate) + obs.longitudeDeg - rightAscension; // 39.2 delta_alpha = GCMath.arcTanDeg( (-rho_cos * GCMath.sinDeg(parallax) * GCMath.sinDeg(h)) / (GCMath.cosDeg(this.declination) - rho_cos * GCMath.sinDeg(parallax) * GCMath.cosDeg(h))); tec.rightAscension = rightAscension + delta_alpha; tec.declination = declination + GCMath.arcTanDeg( ((GCMath.sinDeg(declination) - rho_sin * GCMath.sinDeg(parallax)) * GCMath.cosDeg(delta_alpha)) / (GCMath.cosDeg(declination) - rho_cos * GCMath.sinDeg(parallax) * GCMath.cosDeg(h))); return(tec); }
public static GCHourTime CalcSunrise(GregorianDateTime vct, GCEarthData earth) { double tempSunrise = 180.0; GCSunData sun = new GCSunData(); for (int i = 0; i < 3; i++) { sun.SunPosition(vct, earth, tempSunrise - 180.0); double x; // definition of event double eventdef = 0.01454; /* switch(ed.obs) * { * case 1: // civil twilight * eventdef = 0.10453; * break; * case 2: // nautical twilight * eventdef = 0.20791; * break; * case 3: // astronomical twilight * eventdef = 0.30902; * break; * default:// center of the sun on the horizont * eventdef = 0.01454; * break; * }*/ eventdef = (eventdef / GCMath.cosDeg(earth.latitudeDeg)) / GCMath.cosDeg(sun.declinationDeg); x = GCMath.tanDeg(earth.latitudeDeg) * GCMath.tanDeg(sun.declinationDeg) + eventdef; if ((x >= -1.0) && (x <= 1.0)) { // time of sunrise tempSunrise = 90.0 - earth.longitudeDeg - GCMath.arcSinDeg(x) + sun.equationOfTime; } else { // initial values for the case // that no rise no set for that day tempSunrise = -360.0; break; } } GCHourTime result = new GCHourTime(); result.longitude = sun.longitudeDeg; result.SetDegTime(tempSunrise + earth.OffsetUtcHours * 15.0); return(result); }
//================================================================================== // //================================================================================== public void calc_horizontal(double date, double longitude, double latitude) { double h; h = GCMath.putIn360(GCEarthData.SiderealTimeGreenwich(date) - this.rightAscension + longitude); this.azimuth = GCMath.rad2deg(Math.Atan2(GCMath.sinDeg(h), GCMath.cosDeg(h) * GCMath.sinDeg(latitude) - GCMath.tanDeg(this.declination) * GCMath.cosDeg(latitude))); this.elevation = GCMath.rad2deg(Math.Asin(GCMath.sinDeg(latitude) * GCMath.sinDeg(this.declination) + GCMath.cosDeg(latitude) * GCMath.cosDeg(this.declination) * GCMath.cosDeg(h))); }
public static GCHorizontalCoords equatorialToHorizontalCoords(GCEquatorialCoords eqc, GCEarthData obs, double date) { double localHourAngle; GCHorizontalCoords hc; localHourAngle = GCMath.putIn360(GCEarthData.SiderealTimeGreenwich(date) - eqc.rightAscension + obs.longitudeDeg); hc.azimut = GCMath.rad2deg(Math.Atan2(GCMath.sinDeg(localHourAngle), GCMath.cosDeg(localHourAngle) * GCMath.sinDeg(obs.latitudeDeg) - GCMath.tanDeg(eqc.declination) * GCMath.cosDeg(obs.latitudeDeg))); hc.elevation = GCMath.rad2deg(Math.Asin(GCMath.sinDeg(obs.latitudeDeg) * GCMath.sinDeg(eqc.declination) + GCMath.cosDeg(obs.latitudeDeg) * GCMath.cosDeg(eqc.declination) * GCMath.cosDeg(localHourAngle))); return(hc); }
public static GCHourTime CalcSunset(GregorianDateTime vct, GCEarthData earth) { double tempSunset = 180.0; GCSunData sun = new GCSunData(); for (int i = 0; i < 3; i++) { sun.SunPosition(vct, earth, tempSunset - 180.0); double x; // definition of event double eventdef = GCSunData.RiseAngleLevel; eventdef = (eventdef / GCMath.cosDeg(earth.latitudeDeg)) / GCMath.cosDeg(sun.declinationDeg); x = GCMath.tanDeg(earth.latitudeDeg) * GCMath.tanDeg(sun.declinationDeg) + eventdef; if ((x >= -1.0) && (x <= 1.0)) { // time of sunset tempSunset = 270.0 - earth.longitudeDeg + GCMath.arcSinDeg(x) + sun.equationOfTime; } else { // initial values for the case // that no rise no set for that day tempSunset = -360.0; break; } } GCHourTime result = new GCHourTime(); result.longitude = sun.longitudeDeg; result.SetDegTime(tempSunset + earth.OffsetUtcHours * 15.0); return(result); }
public void CorrectEqatorialWithParallax(double jdate, double latitude, double longitude, double height) { double u, hourAngleBody, delta_alpha; double rho_sin, rho_cos; const double b_a = 0.99664719; // calculate geocentric longitude and latitude of observer u = GCMath.arcTanDeg(b_a * b_a * GCMath.tanDeg(latitude)); rho_sin = b_a * GCMath.sinDeg(u) + height / 6378140.0 * GCMath.sinDeg(latitude); rho_cos = GCMath.cosDeg(u) + height / 6378140.0 * GCMath.cosDeg(latitude); // calculate paralax this.parallax = GCMath.arcSinDeg(GCMath.sinDeg(8.794 / 3600) / (MoonDistance(jdate) / GCMath.AU)); // calculate correction of equatorial coordinates hourAngleBody = GCEarthData.SiderealTimeGreenwich(jdate) + longitude - this.rightAscension; delta_alpha = GCMath.arcTan2Deg(-rho_cos * GCMath.sinDeg(this.parallax) * GCMath.sinDeg(hourAngleBody), GCMath.cosDeg(this.declination) - rho_cos * GCMath.sinDeg(this.parallax) * GCMath.cosDeg(hourAngleBody)); this.rightAscension += delta_alpha; this.declination += GCMath.arcTan2Deg( (GCMath.sinDeg(this.declination) - rho_sin * GCMath.sinDeg(this.parallax)) * GCMath.cosDeg(delta_alpha), GCMath.cosDeg(this.declination) - rho_cos * GCMath.sinDeg(this.parallax) * GCMath.cosDeg(hourAngleBody)); }
/// <summary> /// /// </summary> /// <param name="julianDateUTC">This contains time UTC, that means time observed on Greenwich meridian. DateTime in other /// timezones should be converted into timezone UTC+0h before using in this method.</param> /// <returns></returns> public double GetAscendantDegrees(double julianDateUTC) { double A = GCEarthData.SiderealTimeLocal(julianDateUTC, longitudeDeg, OffsetUtcHours * 15.0); double E = 23.4392911; double ascendant = GCMath.arcTan2Deg(-GCMath.cosDeg(A), GCMath.sinDeg(A) * GCMath.cosDeg(E) + GCMath.tanDeg(latitudeDeg) * GCMath.sinDeg(E)); if (ascendant < 180) { ascendant += 180; } else { ascendant -= 180; } return(GCMath.putIn360(ascendant - GCAyanamsha.GetAyanamsa(julianDateUTC))); }
public static GCEquatorialCoords eclipticalToEquatorialCoords(ref GCEclipticalCoords ecc, double date) { //var GCEquatorialCoords eqc; double epsilon; double nutationLongitude; GCEarthData.CalculateNutations(date, out nutationLongitude, out epsilon); // formula from Chapter 21 ecc.longitude = GCMath.putIn360(ecc.longitude + nutationLongitude); // formulas from Chapter 12 eqc.rightAscension = GCMath.arcTan2Deg(GCMath.sinDeg(ecc.longitude) * GCMath.cosDeg(epsilon) - GCMath.tanDeg(ecc.latitude) * GCMath.sinDeg(epsilon), GCMath.cosDeg(ecc.longitude)); eqc.declination = GCMath.arcSinDeg(GCMath.sinDeg(ecc.latitude) * GCMath.cosDeg(epsilon) + GCMath.cosDeg(ecc.latitude) * GCMath.sinDeg(epsilon) * GCMath.sinDeg(ecc.longitude)); return(eqc); }