public static CAASelenographicMoonDetails CalculateSelenographicPositionOfSun(double JD) { double R = CAAEarth.RadiusVector(JD) * 149597970; double Delta = CAAMoon.RadiusVector(JD); double lambda0 = CAASun.ApparentEclipticLongitude(JD); double lambda = CAAMoon.EclipticLongitude(JD); double beta = CAAMoon.EclipticLatitude(JD); double lambdah = CAACoordinateTransformation.MapTo0To360Range(lambda0 + 180 + Delta / R * 57.296 * Math.Cos(CAACoordinateTransformation.DegreesToRadians(beta)) * Math.Sin(CAACoordinateTransformation.DegreesToRadians(lambda0 - lambda))); double betah = Delta / R * beta; //What will be the return value CAASelenographicMoonDetails details = new CAASelenographicMoonDetails(); //Calculate the optical libration double omega = 0; double DeltaU = 0; double sigma = 0; double I = 0; double rho = 0; double ldash0 = 0; double bdash0 = 0; double ldash20 = 0; double bdash20 = 0; double epsilon = 0; CalculateOpticalLibration(JD, lambdah, betah, ref ldash0, ref bdash0, ref ldash20, ref bdash20, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho); details.l0 = ldash0 + ldash20; details.b0 = bdash0 + bdash20; details.c0 = CAACoordinateTransformation.MapTo0To360Range(450 - details.l0); return(details); }
//////////////////////////////// Implementation /////////////////////////////// protected static void CalculateOpticalLibration(double JD, double Lambda, double Beta, ref double ldash, ref double bdash, ref double ldash2, ref double bdash2, ref double epsilon, ref double omega, ref double DeltaU, ref double sigma, ref double I, ref double rho) { //Calculate the initial quantities double Lambdarad = CAACoordinateTransformation.DegreesToRadians(Lambda); double Betarad = CAACoordinateTransformation.DegreesToRadians(Beta); I = CAACoordinateTransformation.DegreesToRadians(1.54242); DeltaU = CAACoordinateTransformation.DegreesToRadians(CAANutation.NutationInLongitude(JD) / 3600); double F = CAACoordinateTransformation.DegreesToRadians(CAAMoon.ArgumentOfLatitude(JD)); omega = CAACoordinateTransformation.DegreesToRadians(CAAMoon.MeanLongitudeAscendingNode(JD)); epsilon = CAANutation.MeanObliquityOfEcliptic(JD) + CAANutation.NutationInObliquity(JD) / 3600; //Calculate the optical librations double W = Lambdarad - DeltaU / 3600 - omega; double A = Math.Atan2(Math.Sin(W) * Math.Cos(Betarad) * Math.Cos(I) - Math.Sin(Betarad) * Math.Sin(I), Math.Cos(W) * Math.Cos(Betarad)); ldash = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(A) - CAACoordinateTransformation.RadiansToDegrees(F)); if (ldash > 180) { ldash -= 360; } bdash = Math.Asin(-Math.Sin(W) * Math.Cos(Betarad) * Math.Sin(I) - Math.Sin(Betarad) * Math.Cos(I)); //Calculate the physical librations double T = (JD - 2451545.0) / 36525; double K1 = 119.75 + 131.849 * T; K1 = CAACoordinateTransformation.DegreesToRadians(K1); double K2 = 72.56 + 20.186 * T; K2 = CAACoordinateTransformation.DegreesToRadians(K2); double M = CAAEarth.SunMeanAnomaly(JD); M = CAACoordinateTransformation.DegreesToRadians(M); double Mdash = CAAMoon.MeanAnomaly(JD); Mdash = CAACoordinateTransformation.DegreesToRadians(Mdash); double D = CAAMoon.MeanElongation(JD); D = CAACoordinateTransformation.DegreesToRadians(D); double E = CAAEarth.Eccentricity(JD); rho = -0.02752 * Math.Cos(Mdash) + -0.02245 * Math.Sin(F) + 0.00684 * Math.Cos(Mdash - 2 * F) + -0.00293 * Math.Cos(2 * F) + -0.00085 * Math.Cos(2 * F - 2 * D) + -0.00054 * Math.Cos(Mdash - 2 * D) + -0.00020 * Math.Sin(Mdash + F) + -0.00020 * Math.Cos(Mdash + 2 * F) + -0.00020 * Math.Cos(Mdash - F) + 0.00014 * Math.Cos(Mdash + 2 * F - 2 * D); sigma = -0.02816 * Math.Sin(Mdash) + 0.02244 * Math.Cos(F) + -0.00682 * Math.Sin(Mdash - 2 * F) + -0.00279 * Math.Sin(2 * F) + -0.00083 * Math.Sin(2 * F - 2 * D) + 0.00069 * Math.Sin(Mdash - 2 * D) + 0.00040 * Math.Cos(Mdash + F) + -0.00025 * Math.Sin(2 * Mdash) + -0.00023 * Math.Sin(Mdash + 2 * F) + 0.00020 * Math.Cos(Mdash - F) + 0.00019 * Math.Sin(Mdash - F) + 0.00013 * Math.Sin(Mdash + 2 * F - 2 * D) + -0.00010 * Math.Cos(Mdash - 3 * F); double tau = 0.02520 * E * Math.Sin(M) + 0.00473 * Math.Sin(2 * Mdash - 2 * F) + -0.00467 * Math.Sin(Mdash) + 0.00396 * Math.Sin(K1) + 0.00276 * Math.Sin(2 * Mdash - 2 * D) + 0.00196 * Math.Sin(omega) + -0.00183 * Math.Cos(Mdash - F) + 0.00115 * Math.Sin(Mdash - 2 * D) + -0.00096 * Math.Sin(Mdash - D) + 0.00046 * Math.Sin(2 * F - 2 * D) + -0.00039 * Math.Sin(Mdash - F) + -0.00032 * Math.Sin(Mdash - M - D) + 0.00027 * Math.Sin(2 * Mdash - M - 2 * D) + 0.00023 * Math.Sin(K2) + -0.00014 * Math.Sin(2 * D) + 0.00014 * Math.Cos(2 * Mdash - 2 * F) + -0.00012 * Math.Sin(Mdash - 2 * F) + -0.00012 * Math.Sin(2 * Mdash) + 0.00011 * Math.Sin(2 * Mdash - 2 * M - 2 * D); ldash2 = -tau + (rho * Math.Cos(A) + sigma * Math.Sin(A)) * Math.Tan(bdash); bdash = CAACoordinateTransformation.RadiansToDegrees(bdash); bdash2 = sigma * Math.Cos(A) - rho * Math.Sin(A); }
protected static CAAPhysicalMoonDetails CalculateHelper(double JD, ref double Lambda, ref double Beta, ref double epsilon, ref CAA2DCoordinate Equatorial) { //What will be the return value CAAPhysicalMoonDetails details = new CAAPhysicalMoonDetails(); //Calculate the initial quantities Lambda = CAAMoon.EclipticLongitude(JD); Beta = CAAMoon.EclipticLatitude(JD); //Calculate the optical libration double omega = 0; double DeltaU = 0; double sigma = 0; double I = 0; double rho = 0; CalculateOpticalLibration(JD, Lambda, Beta, ref details.ldash, ref details.bdash, ref details.ldash2, ref details.bdash2, ref epsilon, ref omega, ref DeltaU, ref sigma, ref I, ref rho); double epsilonrad = CAACoordinateTransformation.DegreesToRadians(epsilon); //Calculate the total libration details.l = details.ldash + details.ldash2; details.b = details.bdash + details.bdash2; double b = CAACoordinateTransformation.DegreesToRadians(details.b); //Calculate the position angle double V = omega + DeltaU + CAACoordinateTransformation.DegreesToRadians(sigma) / Math.Sin(I); double I_rho = I + CAACoordinateTransformation.DegreesToRadians(rho); double X = Math.Sin(I_rho) * Math.Sin(V); double Y = Math.Sin(I_rho) * Math.Cos(V) * Math.Cos(epsilonrad) - Math.Cos(I_rho) * Math.Sin(epsilonrad); double w = Math.Atan2(X, Y); Equatorial = CAACoordinateTransformation.Ecliptic2Equatorial(Lambda, Beta, epsilon); double Alpha = CAACoordinateTransformation.HoursToRadians(Equatorial.X); details.P = CAACoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sqrt(X * X + Y * Y) * Math.Cos(Alpha - w) / (Math.Cos(b)))); return(details); }
public static CAAPhysicalMoonDetails CalculateTopocentric(double JD, double Longitude, double Latitude) { //First convert to radians Longitude = CAACoordinateTransformation.DegreesToRadians(Longitude); Latitude = CAACoordinateTransformation.DegreesToRadians(Latitude); double Lambda = 0; double Beta = 0; double epsilon = 0; CAA2DCoordinate Equatorial = new CAA2DCoordinate(); CAAPhysicalMoonDetails details = CalculateHelper(JD, ref Lambda, ref Beta, ref epsilon, ref Equatorial); double R = CAAMoon.RadiusVector(JD); double pi = CAAMoon.RadiusVectorToHorizontalParallax(R); double Alpha = CAACoordinateTransformation.HoursToRadians(Equatorial.X); double Delta = CAACoordinateTransformation.DegreesToRadians(Equatorial.Y); double AST = CAASidereal.ApparentGreenwichSiderealTime(JD); double H = CAACoordinateTransformation.HoursToRadians(AST) - Longitude - Alpha; double Q = Math.Atan2(Math.Cos(Latitude) * Math.Sin(H), Math.Cos(Delta) * Math.Sin(Latitude) - Math.Sin(Delta) * Math.Cos(Latitude) * Math.Cos(H)); double Z = Math.Acos(Math.Sin(Delta) * Math.Sin(Latitude) + Math.Cos(Delta) * Math.Cos(Latitude) * Math.Cos(H)); double pidash = pi * (Math.Sin(Z) + 0.0084 * Math.Sin(2 * Z)); double Prad = CAACoordinateTransformation.DegreesToRadians(details.P); double DeltaL = -pidash *Math.Sin(Q - Prad) / Math.Cos(CAACoordinateTransformation.DegreesToRadians(details.b)); details.l += DeltaL; double DeltaB = pidash * Math.Cos(Q - Prad); details.b += DeltaB; details.P += DeltaL * Math.Sin(CAACoordinateTransformation.DegreesToRadians(details.b)) - pidash * Math.Sin(Q) * Math.Tan(Delta); return(details); }
public static AstroRaDec GetPlanet(double jDate, EO planetIn, double locLat, double locLong, double locHeight) { int planet = (int)planetIn; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static CAAGalileanMoonsDetails galDetails; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static CAAEllipticalPlanetaryDetails jupDetails; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static CAAPhysicalJupiterDetails jupPhisical; //C++ TO C# CONVERTER NOTE: This static local variable declaration (not allowed in C#) has been moved just prior to the method: // static double jDateLast = 0; locLong = -locLong; if (planet < 9) { EPD Details = ELL.Calculate(jDate, planetIn); COR corrected = CAAParallax.Equatorial2Topocentric(Details.ApparentGeocentricRA, Details.ApparentGeocentricDeclination, Details.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate); return(new AstroRaDec(corrected.X, corrected.Y, Details.ApparentGeocentricDistance, false, false)); } else if (planet == 9) { double lat = CAAMoon.EclipticLatitude(jDate); double lng = CAAMoon.EclipticLongitude(jDate); double dis = CAAMoon.RadiusVector(jDate) / 149598000; double epsilon = CAANutation.TrueObliquityOfEcliptic(jDate); COR d = CT.Ec2Eq(lng, lat, epsilon); COR corrected = CAAParallax.Equatorial2Topocentric(d.X, d.Y, dis, locLong, locLat, locHeight, jDate); return(new AstroRaDec(corrected.X, corrected.Y, dis, false, false)); } else { if (jDate != jDateLast) { jupDetails = ELL.Calculate(jDate, (EO)4); jupPhisical = CAAPhysicalJupiter.Calculate(jDate); COR corrected = CAAParallax.Equatorial2Topocentric(jupDetails.ApparentGeocentricRA, jupDetails.ApparentGeocentricDeclination, jupDetails.ApparentGeocentricDistance, locLong, locLat, locHeight, jDate); jupDetails.ApparentGeocentricRA = corrected.X; jupDetails.ApparentGeocentricDeclination = corrected.Y; galDetails = GM.Calculate(jDate); jDateLast = jDate; } double jupiterDiameter = 0.000954501; double scale = (Math.Atan(.5 * (jupiterDiameter / jupDetails.ApparentGeocentricDistance))) / 3.1415927 * 180; double raScale = (scale / Math.Cos(jupDetails.ApparentGeocentricDeclination / 180.0 * 3.1415927)) / 15; double xMoon = 0; double yMoon = 0; double zMoon = 0; bool shadow = false; bool eclipsed = false; switch (planet) { case 10: // IO xMoon = galDetails.Satellite1.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite1.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite1.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite1.bInEclipse; shadow = galDetails.Satellite1.bInShadowTransit; break; case 11: //Europa xMoon = galDetails.Satellite2.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite2.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite2.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite2.bInEclipse; shadow = galDetails.Satellite2.bInShadowTransit; break; case 12: //Ganymede xMoon = galDetails.Satellite3.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite3.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite3.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite3.bInEclipse; shadow = galDetails.Satellite3.bInShadowTransit; break; case 13: //Callisto xMoon = galDetails.Satellite4.ApparentRectangularCoordinates.X; yMoon = galDetails.Satellite4.ApparentRectangularCoordinates.Y; zMoon = galDetails.Satellite4.ApparentRectangularCoordinates.Z; eclipsed = galDetails.Satellite4.bInEclipse; shadow = galDetails.Satellite4.bInShadowTransit; break; case 14: // IO Shadow xMoon = galDetails.Satellite1.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite1.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite1.bInShadowTransit; break; case 15: //Europa Shadow xMoon = galDetails.Satellite2.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite2.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite2.bInShadowTransit; break; case 16: //Ganymede Shadow xMoon = galDetails.Satellite3.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite3.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite3.bInShadowTransit; break; case 17: //Callisto Shadow xMoon = galDetails.Satellite4.ApparentShadowRectangularCoordinates.X; yMoon = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Y; zMoon = galDetails.Satellite4.ApparentShadowRectangularCoordinates.Z * .9; shadow = galDetails.Satellite4.bInShadowTransit; break; } double xTemp; double yTemp; double radians = jupPhisical.P / 180.0 * 3.1415927; xTemp = xMoon * Math.Cos(radians) - yMoon * Math.Sin(radians); yTemp = xMoon * Math.Sin(radians) + yMoon * Math.Cos(radians); xMoon = xTemp; yMoon = yTemp; return(new AstroRaDec(jupDetails.ApparentGeocentricRA - (xMoon * raScale), jupDetails.ApparentGeocentricDeclination + yMoon * scale, jupDetails.ApparentGeocentricDistance + (zMoon * jupiterDiameter / 2), shadow, eclipsed)); } }