protected double calculatePosition() { pMoon.MoonCalc(pJulianDate); pLastSunLongitude = GPSun.GetSunLongitude(pJulianDate); double l1 = GPMath.putIn360(pMoon.longitude_deg - pLastSunLongitude - opositeLongitude); return(GPMath.putIn180(l1)); }
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); }
/// <summary> /// /// </summary> /// <param name="arg">Julian Ephemeris (Dynamical) Time</param> /// <returns></returns> public override double getDoubleValue(double arg) { coordMoon = GPAstroEngine.moon_coordinate(arg); coordSun = GPAstroEngine.sun_coordinate(arg); switch (valueType) { case ValueType.Longitude: return(GPMath.putIn180(coordMoon.eclipticalLongitude - coordSun.eclipticalLongitude)); case ValueType.Latitude: return(GPMath.putIn180(coordMoon.eclipticalLatitude - coordSun.eclipticalLatitude)); case ValueType.Azimuth: if (obs != null) { coordMoon.makeTopocentric(obs); GPAstroEngine.calcHorizontal(coordMoon, obs); GPAstroEngine.calcHorizontal(coordSun, obs); return(GPMath.putIn180(coordMoon.azimuth - coordSun.azimuth)); } break; case ValueType.Elevation: if (obs != null) { coordMoon.makeTopocentric(obs); GPAstroEngine.calcHorizontal(coordMoon, obs); GPAstroEngine.calcHorizontal(coordSun, obs); return(GPMath.putIn180(coordMoon.elevation - coordSun.elevation)); } break; case ValueType.DeclinationTopo: if (obs != null) { coordMoon.makeTopocentric(obs); return(GPMath.putIn180(coordMoon.declination - coordSun.declination)); } break; case ValueType.RightAscessionTopo: if (obs != null) { coordMoon.makeTopocentric(obs); return(GPMath.putIn180(coordMoon.right_ascession - coordSun.right_ascession)); } break; case ValueType.Declination: return(GPMath.putIn180(coordMoon.declination - coordSun.declination)); case ValueType.TithiDistance: { double tithi = getTithiDouble(); tithi = 0.51 - Math.Abs(tithi - Math.Floor(tithi) - 0.5); return(tithi); } case ValueType.YogaDistance: { double yoga = getYogaDouble(arg); yoga = 0.51 - Math.Abs(yoga - Math.Floor(yoga) - 0.5); return(yoga); } case ValueType.RightAscession: return(GPMath.putIn180(coordMoon.right_ascession - coordSun.right_ascession)); case ValueType.RightAscessionAbs: return(Math.Abs(GPMath.putIn180(coordMoon.right_ascession - coordSun.right_ascession))); case ValueType.ApparentSiderealTime: return(coordMoon.apparent_sidereal_time); case ValueType.MeanSiderealTime: return(coordMoon.mean_sidereal_time); case ValueType.DynamicTime: return(coordMoon.getDynamicTime()); case ValueType.Nutation: return(coordMoon.getNutation()); case ValueType.Obliquity: return(coordMoon.getObliquity()); case ValueType.AzimuthElevationDistance: if (obs != null) { coordMoon.makeTopocentric(obs); GPAstroEngine.calcHorizontal(coordMoon, obs); GPAstroEngine.calcHorizontal(coordSun, obs); return(GPMath.arcDistanceDeg(coordMoon.azimuth, coordMoon.elevation, coordSun.azimuth, coordSun.elevation)); } break; case ValueType.RigthAscessionDeclinationDistance: return(GPMath.arcDistanceDeg(coordMoon.right_ascession, coordMoon.declination, coordSun.right_ascession, coordSun.declination)); case ValueType.RigthAscessionDeclinationOpositeDistance: return(GPMath.arcDistanceDeg(180 + coordMoon.right_ascession, -coordMoon.declination, coordSun.right_ascession, coordSun.declination)); case ValueType.Tithi: return(getTithiDouble()); case ValueType.Yoga: return(getYogaDouble(arg)); default: break; } return(0); }