Exemplo n.º 1
0
        private void MoveGears(ref movementCase oC, int Notches)
        {
            gears.InnerGear Inner      = new gears.InnerGear();
            gears.BaseGear  LastbaseG  = new gears.BaseGear();
            gears.InnerGear LastInnerG = new gears.InnerGear();

            foreach (gears.BaseGear baseG in oC.baseGears)
            {
                String GearType = baseG.GetType().ToString();
                switch (GearType)
                {
                case "Watch.gears.BaseGear":
                {
                    baseG.BaseMove(LastbaseG, LastInnerG, Notches);
                    LastbaseG = baseG;
                    break;
                }

                case "Watch.gears.InnerGear":
                {
                    Inner = (gears.InnerGear)baseG;
                    Inner.InnerMove(LastbaseG, LastInnerG, Notches);
                    LastInnerG = Inner;
                    break;
                }
                }
            }
            return;
        }
Exemplo n.º 2
0
        public void MakeCompleteMoonDisk()
        {
            movement.supporting     oMoonK          = new movement.supporting();
            movement.MoonRealStatus oMoonRealStatus = new movement.MoonRealStatus();
            movement.makeDisks      mD = new movement.makeDisks();
            movement.movementCase   mC = new movement.movementCase();
            movement.MoonDiskStatus oMoonDiskStatus = new movement.MoonDiskStatus();

            double NotchesMoonDisk = 0;
            double SynoticPhaseThisMoonDiskMinutes = 0;

            DateTime dT = DateTime.Now;
            //DateTime dT = Convert.ToDateTime("Dec 22, 2018 9:48 am");
            //DateTime dT = Convert.ToDateTime("June 13, 2018 12:00 am");
            //DateTime dT = Convert.ToDateTime("Dec. 27, 2118 05:08 PM");
            //DateTime dT = Convert.ToDateTime("Dec. 26, 2140 12:00 AM");
            DateTime findPhaseUTC = dT.ToUniversalTime();

            Double   SynoticPhase_Minutes_Real = Convert.ToDouble(ConfigurationSettings.AppSettings.Get("SynoticPhase_Minutes_Real"));
            DateTime KnownFullMoon_UTC_used    = Convert.ToDateTime(ConfigurationSettings.AppSettings.Get("KnownFullMoon_UTC_used"));

            TimeSpan ts = findPhaseUTC.Subtract(KnownFullMoon_UTC_used);

            // first, get the real moonphase:
            oMoonRealStatus = oMoonK.GetRealMoonPhase(SynoticPhase_Minutes_Real, ts, findPhaseUTC);

            mC = mD.MakeMoonDisk("MakeMoonDisk135Hourly.txt");        // get moonphase for 135 notch disk
            //mC = mD.MakeMoonDisk("MakeMoonDisk90Daily.txt");          // get moonphase for 90 notch disk
            //mC = mD.MakeMoonDisk("MakeMoonDisk59Daily.txt");            // get moonphase for 59 notch disk
            NotchesMoonDisk = oMoonK.GetFinalDiskNotches(mC);

            SynoticPhaseThisMoonDiskMinutes = oMoonK.CalcSynoticPhaseThisMoonDiskMinutes(NotchesMoonDisk,
                                                                                         mC,
                                                                                         movement.supporting._BaseDriverTransmission.smooth,
                                                                                         movement.supporting._BaseDriverStepMethod.runUnder);

            switch (mC.BaseGears[0].DiskBaseUnitDriver)
            {// now get the movement working
            case gears.BaseGear._DiskBaseUnitDriver.hourly:
                mC.incNotches(ref mC, (int)Math.Floor(ts.TotalHours));
                break;

            case gears.BaseGear._DiskBaseUnitDriver.daily:
                mC.incNotches(ref mC, (int)Math.Floor(ts.TotalDays));
                break;
            }
            // get all final moon phase parameters for type of movement and accuracy
            oMoonDiskStatus = oMoonK.RunMoonModule(mC, NotchesMoonDisk, SynoticPhaseThisMoonDiskMinutes, ts, findPhaseUTC, oMoonRealStatus.LunationsElapsed);
        }
Exemplo n.º 3
0
        public List <string> ListAllProperties(movementCase oC, bool toFile, string Fln)
        {
            List <string> listProperties = new List <string>();

            foreach (gears.BaseGear baseG in oC.baseGears)
            {
                switch (baseG.GetType().ToString())
                {
                case "Watch.gears.BaseGear":
                {
                    listProperties.Add(" >>>>>>>>>>> BaseGear <<<<<<<<<<<");
                    foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(baseG))
                    {
                        string name  = descriptor.Name;
                        object value = descriptor.GetValue(baseG);
                        listProperties.Add(name + "=" + value);
                    }
                    continue;
                }

                case "Watch.gears.InnerGear":
                {
                    listProperties.Add(" >>>>>>>>>>> InnerGear <<<<<<<<<<<");
                    Watch.gears.InnerGear oInner = (Watch.gears.InnerGear)baseG;
                    foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(oInner))
                    {
                        string name  = descriptor.Name;
                        object value = descriptor.GetValue(oInner);
                        listProperties.Add(name + "=" + value);
                    }
                    continue;
                }
                }
            }


            if (toFile)
            {
                TextWriter tw = new StreamWriter(Fln);
                foreach (String s in listProperties)
                {
                    tw.WriteLine(s);
                }
                tw.Close();
                //Console.Write("saved to filename:" + Fln);
                //Console.Read();
            }
            return(listProperties);
        }
Exemplo n.º 4
0
        public double GetFinalGearPosition(movementCase oC)
        {
            double FinalGearPosition = 0;
            int    i = oC.baseGears.Count() - 1;

            switch (oC.baseGears[i].GetType().ToString())
            {
            case "Watch.gears.BaseGear":
            {
                FinalGearPosition = oC.baseGears[i].BaseTeethNotchesTraversed;
                break;
            }

            case "Watch.gears.InnerGear":
            {
                Watch.gears.InnerGear oInner = (Watch.gears.InnerGear)oC.baseGears[i];
                FinalGearPosition = oInner.BaseTeethNotchesTraversed;
                break;
            }
            }
            return(FinalGearPosition);
        }
Exemplo n.º 5
0
        private void MoveGears(ref movementCase oC, int Notches, movement.supporting._SpinMode sM)
        {
            switch (sM)
            {
            case movement.supporting._SpinMode.FastAndDirty:
            {         // move each gear X times, unrealistic, but fast and accurate
                MoveGears(ref oC, Notches);
                return;
            }

            case movement.supporting._SpinMode.Purist:
            {         // move each gear 1 notch at a time, slow and accurate
                if (Notches > 1)
                {
                    int iCnt;
                    for (iCnt = 1; iCnt <= Notches; iCnt++)
                    {
                        MoveGears(ref oC, 1);
                    }
                }
                return;
            }
            }
        }
Exemplo n.º 6
0
 public void incNotches(ref movementCase oC, int iNotchInc)
 {
     //MoveGears(ref oC, iNotchInc);
     MoveGears(ref oC, iNotchInc, supporting._SpinMode.FastAndDirty);
 }