Example #1
0
        public FormTargetTrack(DailyPosition dp, DailyPosition mp, string targetNameS)
        {
            InitializeComponent();
            targetName = targetNameS;

            tgtDateUTC   = dp.UTCdate;
            moonDateUTC  = mp.iRise;
            tgtUpH       = dp.Rising.ToLocalTime().Hour + (dp.Rising.ToLocalTime().Minute / 60.0);
            tgtDownH     = dp.Setting.ToLocalTime().Hour + (dp.Setting.ToLocalTime().Minute / 60.0);
            tgtDecD      = 90.0 - Transform.RadiansToDegrees(dp.Position.Dec);
            tgtPosition  = dp.Position;
            MoonPosition = mp.Position;
            obsLocation  = dp.Location;
            //Set lat
            obsLatD = Transform.RadiansToDegrees(dp.Location.Lat);

            //Moon look up stuff
            Celestial.RADec moonRADec = DailyPosition.MoonRaDec(Celestial.DateToJ2kC(dp.UTCdate));
            moonDecD = 90 - Transform.RadiansToDegrees(mp.Position.Dec);
            //Get the rise/set times from TSX
            sky6StarChart         tsxs = new sky6StarChart();
            sky6ObjectInformation tsxo = new sky6ObjectInformation();

            //Set the date/time to the local date for the target
            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, Celestial.DateToJulian(tgtDateUTC));

            //Get some target stuff that's hard to calculate
            tsxs.Find(targetName);
            //wait a second
            System.Threading.Thread.Sleep(500);
            tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_TRANSIT_TIME);
            tgtTransitH = tsxo.ObjInfoPropOut;

            //Test stuff
            //double testmoontransitH = MoonPosition.TransitTime(tgtDateUTC, obsLocation);

            //Get some moon stuff now
            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, Celestial.DateToJulian(moonDateUTC));
            tsxs.Find("Moon");
            //wait a second
            System.Threading.Thread.Sleep(500);
            tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME);
            moonRiseH = tsxo.ObjInfoPropOut;
            tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME);
            moonSetH = tsxo.ObjInfoPropOut;
            //put the target back in
            tsxs.Find(targetName);

            tsxs = null;
            tsxo = null;
            return;
        }
Example #2
0
 public static DailyPosition[] MoonPhase(DailyPosition[] tgtdata)
 {
     //Computes moon phase for each date in tgtdata
     Celestial.RADec sunradec;
     Celestial.RADec moonradec;
     foreach (DailyPosition dp in tgtdata)
     {
         sunradec  = DailyPosition.SunRADec(Celestial.DateToJ2kC(dp.UTCdate));
         moonradec = DailyPosition.MoonRaDec(Celestial.DateToJ2kC(dp.UTCdate));
         dp.SetMoonPhase(sunradec.RA, moonradec.RA);
     }
     return(tgtdata);
 }
Example #3
0
 public static DailyPosition[] MoonCycle(DailyPosition[] tgtspots, Celestial.LatLon obsLocation)
 {
     //Calculate an array of dailypositions of intervals when the moon is above the horizon
     DailyPosition[] moonedspots = new DailyPosition[tgtspots.Length];
     for (int dayidx = 0; dayidx < tgtspots.Length; dayidx++)
     {
         moonedspots[dayidx] = new DailyPosition(tgtspots[dayidx].Rising,
                                                 tgtspots[dayidx].Setting,
                                                 DailyPosition.MoonRaDec(Celestial.DateToJ2kC(tgtspots[dayidx].Rising)),
                                                 obsLocation,
                                                 0);
     }
     return(moonedspots);
 }
Example #4
0
        //public methods for managing the daily position functions
        //SunCycle generates a year of sunrise and sunset events
        //TargetCycle generates a year of target rise and set events (within sunrise-sunset)
        //MoonCycle generates a year of moon rise and set events (within target rise-set)
        //MoonPhase adds phase to target events
        //Moonclear adds moonless percentage to target events

        public static DailyPosition[] SunCycle(int dYear, Celestial.LatLon obsLocation)
        {
            //Calculates a year//s worth of sunrises and sunsets
            const double twilight = -18; //(degrees)

            DailyPosition[] sunspots = new DailyPosition[367];
            Celestial.RADec sunpos;

            DateTime ndate = new DateTime(dYear, 1, 1, 0, 0, 0); //create datetime object for jan 1, dYear
            DateTime udate = ndate.ToUniversalTime();            //convert to UTC
            DateTime sdate = udate.AddDays(-1);                  //back up one day to make sure Jan 1 is covered

            for (int dayidx = 0; dayidx < sunspots.Length; dayidx++)
            {
                DateTime tdate = sdate.AddDays(dayidx);
                sunpos           = DailyPosition.SunRADec(Celestial.DateToJ2kC(tdate));
                sunspots[dayidx] = new DailyPosition(tdate,
                                                     tdate.AddDays(1),
                                                     sunpos,
                                                     obsLocation,
                                                     twilight);
            }
            return(sunspots);
        }