Пример #1
0
        public static void TestSunCoordinates()
        {
            GPObserver obs = new GPObserver();

            obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude);
            GPJulianTime dp = new GPJulianTime();

            dp.setLocalJulianDay(2456710.500000);
            for (int k = 0; k < 26; k++)
            {
                //dp = MA.GPMeeusEngine.GetNextMoonEvent(dp, obs, out kind);
                GPCelestialBodyCoordinates crd = GPAstroEngine.sun_coordinate(dp.getGreenwichJulianEphemerisDay());
                //srt = MA.GPMeeusEngine.GetSiderealTime(dp.GetJulianDay(), out deltaphi, out epsilon);
                //crd = MA.GPMeeusEngine.moon_coordinate(2448724.5);
                crd.makeTopocentric(obs);
                GPAstroEngine.calcHorizontal(crd, obs);
                //Log("time {0}   deltaphi {1}  epsilon {2} sidereal {3}", dp, deltaphi, epsilon, srt/15);
                //Log("time {0}   altitude {1}  azimuth {2}", dp, crd.elevation, crd.azimuth);
                //Log("time {0}   ra {1}  dec {2}", dp, crd.right_ascession, crd.declination);
                //Log("RA={0} DEC={1}", crd.right_ascession, crd.elevation);
                //Log("AZ={0} EL={1} RA", crd.azimuth, crd.elevation);
                Log("{0}", crd.elevation);
                //                Log("next event = {0}, {1}, {2}\n", dp, kind, crd.elevation);
                dp.AddHours(1);
            }
        }
Пример #2
0
 public void MoonCalc(double jdate)
 {
     coord           = GPAstroEngine.moon_coordinate(jdate);
     radius          = coord.distanceFromEarth;
     longitude_deg   = coord.eclipticalLongitude;
     latitude_deg    = coord.eclipticalLatitude;
     declination     = coord.declination;
     right_ascession = coord.right_ascession;
 }
Пример #3
0
 // tithi at sunset
 public int getTithiAtSunset()
 {
     if (p_tithi_sunset < 0)
     {
         GPCelestialBodyCoordinates moonCoord = GPAstroEngine.moon_coordinate(sun.set.getJulianGreenwichTime());
         double d = GPMath.putIn360(moonCoord.eclipticalLongitude - sun.longitude_set_deg - 180) / 12.0;
         p_tithi_sunset = Convert.ToInt32(Math.Floor(d));
     }
     return(p_tithi_sunset);
 }
Пример #4
0
        public static void TestSiderealTime()
        {
            GPObserver obs = new GPObserver();

            obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude);
            GPJulianTime dp = new GPJulianTime();

            dp.setLocalJulianDay(2456710.500000);
            for (int k = 0; k < 26; k++)
            {
                GPCelestialBodyCoordinates crd = GPAstroEngine.sun_coordinate(dp.getGreenwichJulianEphemerisDay());
                Log("{0}", crd.apparent_sidereal_time / 15);
                dp.AddHours(1);
            }
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="jdate">Julian day (Universal Time)</param>
        /// <returns>Returns value of ecliptic longitude</returns>
        public static double GetSunLongitude(double jdate)
        {
            GPCelestialBodyCoordinates coord = GPAstroEngine.sun_coordinate(jdate);

            return(coord.eclipticalLongitude);
        }
Пример #6
0
        public override double getDoubleValue(double arg)
        {
            coord = GPAstroEngine.moon_coordinate(arg);

            switch (valueType)
            {
            case ValueType.Longitude:
                return(coord.eclipticalLongitude);

            case ValueType.Latitude:
                return(coord.eclipticalLatitude);

            case ValueType.Azimuth:
                if (obs != null)
                {
                    coord.makeTopocentric(obs);
                    GPAstroEngine.calcHorizontal(coord, obs);
                    return(coord.azimuth);
                }
                break;

            case ValueType.Elevation:
                if (obs != null)
                {
                    coord.makeTopocentric(obs);
                    GPAstroEngine.calcHorizontal(coord, obs);
                    return(coord.elevation);
                }
                break;

            case ValueType.DeclinationTopo:
                if (obs != null)
                {
                    coord.makeTopocentric(obs);
                    return(coord.declination);
                }
                break;

            case ValueType.RightAscessionTopo:
                if (obs != null)
                {
                    coord.makeTopocentric(obs);
                    return(coord.right_ascession);
                }
                break;

            case ValueType.Declination:
                return(coord.declination);

            case ValueType.RightAscession:
                return(coord.right_ascession);

            case ValueType.Distance:
                return(coord.distanceFromEarth);

            case ValueType.ApparentSiderealTime:
                return(coord.apparent_sidereal_time);

            case ValueType.MeanSiderealTime:
                return(coord.mean_sidereal_time);

            case ValueType.DynamicTime:
                return(coord.getDynamicTime());

            case ValueType.Nutation:
                return(coord.getNutation());

            case ValueType.Obliquity:
                return(coord.getObliquity());

            case ValueType.NaksatraDistance:
            {
                double naksatraReal = getNaksatraDouble(arg);
                naksatraReal = 0.51 - Math.Abs(naksatraReal - Math.Floor(naksatraReal) - 0.5);
                return(naksatraReal);
            }

            case ValueType.Naksatra:
                return(getNaksatraDouble(arg));

            default:
                break;
            }

            return(0);
        }
Пример #7
0
        public override double getDoubleValue(double arg)
        {
            coord = GPAstroEngine.sun_coordinate(arg);

            switch (valueType)
            {
            case ValueType.Longitude:
                return(coord.eclipticalLongitude);

            case ValueType.Latitude:
                return(coord.eclipticalLatitude);

            case ValueType.Azimuth:
                if (obs != null)
                {
                    GPAstroEngine.calcHorizontal(coord, obs);
                    return(coord.azimuth);
                }
                break;

            case ValueType.Elevation:
                if (obs != null)
                {
                    GPAstroEngine.calcHorizontal(coord, obs);
                    return(coord.elevation);
                }
                break;

            case ValueType.DeclinationTopo:
                return(coord.declination);

            case ValueType.RightAscessionTopo:
                return(coord.right_ascession);

            case ValueType.Declination:
                return(coord.declination);

            case ValueType.RightAscession:
                return(coord.right_ascession);

            case ValueType.Distance:
                return(coord.distanceFromEarth);

            case ValueType.ApparentSiderealTime:
                return(coord.apparent_sidereal_time);

            case ValueType.MeanSiderealTime:
                return(coord.mean_sidereal_time);

            case ValueType.DynamicTime:
                return(coord.getDynamicTime());

            case ValueType.Nutation:
                return(coord.getNutation());

            case ValueType.Obliquity:
                return(coord.getObliquity());

            case ValueType.Sankranti:
                return(getSankrantiDouble(arg));

            case ValueType.SankrantiDistance:
            {
                double sankranti = getSankrantiDouble(arg);
                sankranti = 0.51 - Math.Abs(sankranti - Math.Floor(sankranti) - 0.5);
                return(sankranti);
            }

            default:
                break;
            }

            return(0);
        }
Пример #8
0
        /// <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);
        }