Beispiel #1
0
        public movement.MoonDiskStatus RunMoonModule(movement.movementCase mC, double NotchesMoonDisk, double SynoticPhaseThisMoonDiskMinutes, TimeSpan ts, DateTime findPhaseUTC, double LunationsElapsedReal)
        {
            supporting     oMoonK                    = new supporting();
            MoonDiskStatus oMoonDiskStatus           = new MoonDiskStatus();
            makeDisks      oMakeMoonDisk             = new makeDisks();
            Double         SynoticPhase_Minutes_Real = Convert.ToDouble(ConfigurationSettings.AppSettings.Get("SynoticPhase_Minutes_Real"));
            DateTime       KnownFullMoon_UTC_used    = Convert.ToDateTime(ConfigurationSettings.AppSettings.Get("KnownFullMoon_UTC_used"));

            oMoonDiskStatus.LunationsElapsed  = ts.TotalMinutes / SynoticPhaseThisMoonDiskMinutes;
            oMoonDiskStatus.FastOrSlowMinutes = (double)(oMoonDiskStatus.LunationsElapsed - LunationsElapsedReal) * SynoticPhase_Minutes_Real;
            oMoonDiskStatus.TargetDateUTC     = findPhaseUTC;
            oMoonDiskStatus.RefDateUTC        = KnownFullMoon_UTC_used;

            double GearNotches = mC.GetFinalGearPosition(mC);

            double FullMoonOffSet     = NotchesMoonDisk / 4.0;
            double MoonDiskFullTravel = FullMoonOffSet + GearNotches;

            if (MoonDiskFullTravel > NotchesMoonDisk)
            {
                double MoonDiskFactor        = MoonDiskFullTravel / NotchesMoonDisk;
                double OneMoonDiskRevolution = MoonDiskFactor - Math.Floor(MoonDiskFactor);
                MoonDiskFullTravel = OneMoonDiskRevolution * NotchesMoonDisk;
            }

            // for 135 notched disk, here is the legend:
            //new   - full      - new
            //1     - 33.75     - 67.5
            //67.5  - 101.25    - 135

            // for 90 notched disk, here is the legend:
            //new   - full      - new
            //1     - 22.5      - 45
            //45    - 67.5      - 90

            oMoonDiskStatus.NotchPositionOnMoonDisk = MoonDiskFullTravel;

            // close to 0 or 100 percent = Full Moon
            // close to 50 percent = New Moon
            if (MoonDiskFullTravel > FullMoonOffSet * 2)
            {
                MoonDiskFullTravel = MoonDiskFullTravel - FullMoonOffSet * 2;
            }
            double OfCompletePhase = (MoonDiskFullTravel / (FullMoonOffSet * 2)) * 100;

            oMoonDiskStatus.AgeOfMoonDays      = oMoonK.AgeOfMoon(OfCompletePhase, SynoticPhaseThisMoonDiskMinutes);
            oMoonDiskStatus.ofCompletePhasePct = Math.Round(OfCompletePhase, 2);
            double NewCompleteOfPhase = OfCompletePhase + 50;

            if (NewCompleteOfPhase > 100)
            {
                NewCompleteOfPhase = NewCompleteOfPhase - 100;
            }
            oMoonDiskStatus.QuarterStatus      = oMoonK.GetPhaseQuarterStatus(NewCompleteOfPhase);
            oMoonDiskStatus.Notches            = NotchesMoonDisk;
            oMoonDiskStatus.listGearProperties = mC.ListAllProperties(mC, false, "SavedList.txt");
            oMoonDiskStatus.PrecisionYrs       = GetPrecision((double)SynoticPhaseThisMoonDiskMinutes);

            return(oMoonDiskStatus);
        }
Beispiel #2
0
        public double CalcSynoticPhaseThisMoonDiskMinutes(double NotchesMoonDisk,
                                                          movement.movementCase mC,
                                                          _BaseDriverTransmission BaseDriverTransmission,
                                                          _BaseDriverStepMethod BaseDriverStepMethod)

        {
            double SingleMoonPhase = NotchesMoonDisk / 2.0;
            // how long before last gear reaches SingleMoonPhase = 1/2 moon disk?
            double iCntr = 1.0;

            double iCntr_Last = 0;
            double dFinalGearPosition_Last = 0;

            double dFinalGearPosition = 0;

            for (iCntr = 1; iCntr < double.PositiveInfinity; iCntr++)
            {
                mC.incNotches(ref mC, 1); // now get the movement working
                dFinalGearPosition = mC.GetFinalGearPosition(mC);
                if (dFinalGearPosition > SingleMoonPhase)
                {
                    switch (BaseDriverTransmission)
                    {
                    // does the first input gear Step or Rotate Smoothly?
                    // ex.  gears can move smoothly for better resolution.
                    //      or they can STEP into the next notch, this results in the worest resolution!
                    case _BaseDriverTransmission.stepwise:
                    {
                        switch (BaseDriverStepMethod)
                        {           // do you want to assume the synotic phase runs just under or over
                        // 1/2 revolution of the moon disk?
                        case _BaseDriverStepMethod.runOver:
                        {
                            break;
                        }

                        case _BaseDriverStepMethod.runUnder:
                        {
                            iCntr = iCntr_Last;
                            dFinalGearPosition = dFinalGearPosition_Last;
                            break;
                        }
                        }

                        break;
                    }

                    case _BaseDriverTransmission.smooth:
                    {
                        // at this point, we know the iCntr should be exactly between
                        // iCntr and iCntr_Last. This can be calculated by using the ratio of
                        // of iCntr to dFinalGearPosition, or even iCntr_Last to dFinalGearPosition_Last
                        // and multiplying times SingleMoonPhase.
                        // this will return the correct 'smooth' elapsed time period.
                        iCntr = (iCntr / dFinalGearPosition) * SingleMoonPhase;
                        break;
                    }
                    }

                    break;
                }
                iCntr_Last = iCntr;
                dFinalGearPosition_Last = dFinalGearPosition;
            }


            switch (mC.BaseGears[0].DiskBaseUnitDriver)
            {                                    // rtn Minutes
            case gears.BaseGear._DiskBaseUnitDriver.daily:
                return((double)iCntr * 24 * 60); // rtn Minutes

            case gears.BaseGear._DiskBaseUnitDriver.hourly:
                return((double)iCntr * 60);    // rtn Minutes

            case gears.BaseGear._DiskBaseUnitDriver.minutes:
                return(-1);    // not defined yet

            case gears.BaseGear._DiskBaseUnitDriver.seconds:
                return(-1);   // not defined yet
            }
            return(-1);
        }