示例#1
1
        //! Reads TwoLineElement data and converts it to Tle
        /*!
        \param string Line 1
        \param string Line 2
        \param string Name = null
        * if name = null then Internatioanl Designater is taken as name
        * Example
        * NOAA 14
        * 1 23455U 94089A   15094.47912277  .00000079  00000-0  64323-4 0  9995
        * 2 23455  98.7542 177.4401 0008423 292.6752 195.2467 14.14031457 45115
        \return Tle tle-Class
        */
        public static Tle parseTle(string tleLine1, string tleLine2,
            string tleName = null)
        {
            int satCl = 0;
            string noradId;
            int startYear = 0;
            int startNumber = 0;
            string intDes = "--";
            int epochYear;
            double epochDay;

            double firstMeanMotion;
            double secondMeanMotion;
            double dragTerm;
            double ephemeris;
            int setNumber = 0;
            int checksum1;

            //Start Line 1
            //check if data maches Checksumm
            bool valid1 = isValid(tleLine1);
            bool valid2 = isValid(tleLine2);

            if (!valid1 && !valid2)
            {
                //Error data does not match up with checksumm
                //return null;
            }

            string[] s1 = tleLine1.Split(' ');
            string[] line1 = new string[9];
            int count = 0;
            for (int i = 0; i < s1.Length; i++)
            {
                if (s1[i].Length > 0)
                {
                    line1[count] = s1[i];
                    count++;
                }
            }

            string sclass = line1[1].Substring(line1[1].Length - 1);
                if (sclass == "U")
                {
                    satCl = 0x0;
                }
                if (sclass == "C")
                {
                    satCl = 0x1;
                }
                if (sclass == "S")
                {
                    satCl = 0x2;
                }

            noradId = line1[1].Remove(line1[1].Length - 1);

            //check if Line contains International Designator Information
            //if Not then skip setting them
            int noID = 0;
            if (count == 8)
            {
                noID = -1;
            }
            else
            {
                startYear = Convert.ToInt32(line1[2].Substring(0, 2));
                startNumber = Convert.ToInt32(line1[2].Substring(2, 3));
                intDes = line1[2].Substring(5);
            }

            epochYear = Convert.ToInt32(line1[3+noID].Substring(0, 2));
            string epDay = line1[3 + noID].Substring(2);
            epochDay = double.Parse(epDay, CultureInfo.GetCultureInfo("en-US"));

            firstMeanMotion = double.Parse(line1[4 + noID], CultureInfo.GetCultureInfo("en-US"));

            int zeros = Convert.ToInt32(line1[5 + noID].Substring(line1[5].Length - 1));
            line1[5 + noID] = line1[5 + noID].Substring(0, line1[5 + noID].IndexOf('-'));
            if (line1[5 + noID].Length > 0)
            {
                if (line1[5 + noID][0] == '+' || line1[5 + noID][0] == '-')
                {
                    line1[5 + noID] = line1[5 + noID].Insert(1, ".");
                    for (int i = 0; i < zeros; i++)
                        line1[5 + noID] = line1[5 + noID].Insert(2, "0");
                }
                else
                {
                    line1[5 + noID] = line1[5 + noID].Insert(0, ".");
                    for (int i = 0; i < zeros; i++)
                        line1[5 + noID] = line1[5 + noID].Insert(1, "0");
                }
                secondMeanMotion = double.Parse(line1[5 + noID], CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                secondMeanMotion = 0.0;
            }

            zeros = Convert.ToInt32(line1[6 + noID].Substring(line1[6 + noID].Length - 1));
            if (line1[6 + noID][line1[6 + noID].Length - 2] == '-')
            {
                line1[6 + noID] = line1[6 + noID].Substring(0, line1[6 + noID].IndexOf('-'));
            }
            else
            {
                line1[6 + noID] = line1[6 + noID].Substring(0, line1[6 + noID].IndexOf('+'));
            }
            if (line1[6 + noID].Length > 0)
            {
                if (line1[6 + noID][0] == '+' || line1[6 + noID][0] == '-')
                {
                    line1[6 + noID] = line1[6 + noID].Insert(1, ".");
                    for (int i = 0; i < zeros; i++)
                        line1[6 + noID] = line1[6 + noID].Insert(2, "0");
                }
                else
                {
                    line1[6 + noID] = line1[6 + noID].Insert(0, ".");
                    for (int i = 0; i < zeros; i++)
                        line1[6 + noID] = line1[6 + noID].Insert(1, "0");
                }
                dragTerm = double.Parse(line1[6 + noID], CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                dragTerm = 0.0;
            }

            ephemeris = double.Parse(line1[7 + noID], CultureInfo.GetCultureInfo("en-US"));

            //check if Element Setnumber is included in TLE line
            //if not then there is only Checksum here
            if (line1[8 + noID].Length > 1)
            {
                setNumber = Convert.ToInt32(line1[8 + noID].Substring(0, line1[8 + noID].Length - 1));
                checksum1 = Convert.ToInt32(line1[8 + noID].Substring(line1[8 + noID].Length - 1));
            }
            else
            {
                checksum1 = Convert.ToInt32(line1[8 + noID]);
            }

            int satNumber;
            double inclination;
            double rightAscension;
            double eccentricity;
            double perigee;
            double meanAnomoly;
            double meanMotion;
            double relevationNumber = 0;
            int checksum2 = 0;

            //Start Line2

            string[] s2 = tleLine2.Split(' ');
            string[] line2 = new string[9];
            count = 0;
            for (int i = 0; i < s2.Length; i++)
            {
                if (s2[i].Length > 0)
                {
                    line2[count] = s2[i];
                    count++;
                }
            }

            satNumber = Convert.ToInt32(line2[1]);
            inclination = double.Parse(line2[2], CultureInfo.GetCultureInfo("en-US"));
            rightAscension = double.Parse(line2[3], CultureInfo.GetCultureInfo("en-US"));
            line2[4] = line2[4].Insert(0, ".");
            eccentricity = double.Parse(line2[4], CultureInfo.GetCultureInfo("en-US"));
            perigee = double.Parse(line2[5], CultureInfo.GetCultureInfo("en-US"));
            meanAnomoly = double.Parse(line2[6], CultureInfo.GetCultureInfo("en-US"));
            if (line2[8] != null )
            {
                meanMotion = double.Parse(line2[7], CultureInfo.GetCultureInfo("en-US"));
                checksum2 = Convert.ToInt32(line2[8].Substring(line2[8].Length - 1));
                relevationNumber = double.Parse(line2[8].Substring(0, line2[8].Length - 1),
                    CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                checksum2 = Convert.ToInt32(line2[7].Substring(line2[7].Length - 1));
                meanMotion = double.Parse(line2[7].Substring(0, 11),
                    CultureInfo.GetCultureInfo("en-US"));
                relevationNumber = double.Parse(line2[7].Substring(11, 5),
                    CultureInfo.GetCultureInfo("en-US"));
            }

            if (tleName == null)
            {
                tleName = startYear + startNumber + intDes;
            }
            if (tleName[0] == '0' && tleName[1] == ' ')
            {
                tleName = tleName.Remove(0, 2);
            }

            Tle ret = new Tle(tleName, noradId, (Enum.satClass)satCl, startYear, startNumber, intDes,
                epochYear, epochDay, firstMeanMotion, secondMeanMotion, dragTerm,
                ephemeris, setNumber, checksum1, satNumber, inclination, rightAscension,
                eccentricity, perigee, meanAnomoly, meanMotion, relevationNumber, checksum2);
            return ret;
        }
示例#2
0
        //! Calculate satellite position at a single point in time

        /*!
         *  \param tle of satellite
         *  \param EpochTime to calculate position
         *  \param int WGS-Data to use 0 = WGS_72; 1 = WGS_84
         *  \return SGP4Data containing satellite position data
         */
        public static Sgp4Data getSatPositionAtTime(Tle satellite, EpochTime atTime, Sgp4.wgsConstant wgs)
        {
            Sgp4 sgp4Propagator = new Sgp4(satellite, wgs);

            sgp4Propagator.runSgp4Cal(atTime, atTime, 1 / 60.0);
            return(sgp4Propagator.getResults()[0]);
        }
示例#3
0
        public static List <Pass> CalculatePasses(Coordinate position, Tle satellite, EpochTime startTime, int accuracy = 15,
                                                  int maxNumberOfDays = 5, Sgp4.wgsConstant wgs = Sgp4.wgsConstant.WGS_84)
        {
            List <Pass> results = new List <Pass>();
            EpochTime   epoch   = new EpochTime(startTime);
            EpochTime   end     = new EpochTime(startTime);

            end.addDays(maxNumberOfDays);
            while (epoch < end)
            {
                Sgp4Data satPos = getSatPositionAtTime(satellite, epoch, wgs);
                if (SatFunctions.isSatVisible(position, 0.0, epoch, satPos))
                {
                    EpochTime passStart    = new EpochTime(epoch);
                    Point3d   spherical    = SatFunctions.calcSphericalCoordinate(position, epoch, satPos);
                    double    maxElevation = spherical.z;
                    epoch.addTick(accuracy);
                    satPos = getSatPositionAtTime(satellite, epoch, wgs);
                    while (SatFunctions.isSatVisible(position, 0.0, epoch, satPos))
                    {
                        spherical = SatFunctions.calcSphericalCoordinate(position, epoch, satPos);
                        if (maxElevation < spherical.z)
                        {
                            maxElevation = spherical.z;
                        }
                        epoch.addTick(accuracy);
                    }
                    results.Add(new One_Sgp4.Pass(position, passStart, new EpochTime(epoch), maxElevation * 180.0 / pi));
                }
                epoch.addTick(accuracy);
            }
            return(results);
        }
示例#4
0
        //! Calculate Passes of a satellite for ceratin number of days from a starting time

        /*!
         *  \param Coordinate position of observer
         *  \param Tle satellite data
         *  \param EpochTime of startpoint
         *  \param int accuracy time between calculations default 15 seconds
         *  \param int number of days to calculate default 5 days
         *  \param int WGS-Data to use 0 = WGS_72; 1 = WGS_84 default WGS 84
         *  \return List<Pass> List of passes satellite is visible
         */
        public static List <Pass> CalculatePasses(Coordinate position, Tle satellite, EpochTime startTime, int accuracy = 15,
                                                  int maxNumberOfDays = 5, Sgp4.wgsConstant wgs = Sgp4.wgsConstant.WGS_84)
        {
            List <Pass> results = new List <Pass>();
            EpochTime   epoch   = new EpochTime(startTime);
            EpochTime   end     = new EpochTime(startTime);

            end.addDays(maxNumberOfDays);

            while (epoch < end)
            {
                Sgp4Data satPos = getSatPositionAtTime(satellite, epoch, wgs);
                if (SatFunctions.isSatVisible(position, 0.0, epoch, satPos))
                {
                    Point3d    spherical     = SatFunctions.calcSphericalCoordinate(position, epoch, satPos);
                    PassDetail startDetails  = new PassDetail(new EpochTime(epoch), spherical.z, spherical.y, spherical.x);
                    PassDetail maxEleDetails = new PassDetail(new EpochTime(epoch), spherical.z, spherical.y, spherical.x);
                    //double maxElevation = spherical.z;
                    epoch.addTick(accuracy);
                    satPos = getSatPositionAtTime(satellite, epoch, wgs);
                    while (spherical.z >= 0)
                    //while (SatFunctions.isSatVisible(position, 0.0, epoch, satPos))
                    {
                        spherical = SatFunctions.calcSphericalCoordinate(position, epoch, satPos);
                        if (maxEleDetails.elevation < spherical.z)
                        {
                            maxEleDetails = new PassDetail(new EpochTime(epoch), spherical.z, spherical.y, spherical.x);
                        }
                        epoch.addTick(accuracy);
                        satPos = getSatPositionAtTime(satellite, epoch, wgs);
                    }
                    PassDetail endDetails = new PassDetail(new EpochTime(epoch), spherical.z, spherical.y, spherical.x);
                    results.Add(new One_Sgp4.Pass(position, startDetails, maxEleDetails, endDetails));
                }
                epoch.addTick(accuracy);
            }
            return(results);
        }
示例#5
0
        //! Reads TwoLineElement data and converts it to Tle

        /*!
         * \param string Line 1
         * \param string Line 2
         * \param string Name = null
         * if name = null then Internatioanl Designater is taken as name
         * Example
         * NOAA 14
         * 1 23455U 94089A   15094.47912277  .00000079  00000-0  64323-4 0  9995
         * 2 23455  98.7542 177.4401 0008423 292.6752 195.2467 14.14031457 45115
         * \return Tle tle-Class
         */
        public static Tle parseTle(string tleLine1, string tleLine2,
                                   string tleName = null)
        {
            int    satCl = 0;
            string noradId;
            int    startYear   = 0;
            int    startNumber = 0;
            string intDes      = "--";
            int    epochYear;
            double epochDay;

            double firstMeanMotion;
            double secondMeanMotion;
            double dragTerm;
            double ephemeris;
            int    setNumber = 0;
            int    checksum1;

            //Start Line 1
            //check if data maches Checksumm
            bool valid1 = isValid(tleLine1);
            bool valid2 = isValid(tleLine2);

            if (!valid1 && !valid2)
            {
                //Error data does not match up with checksumm
                //return null;
            }

            string[] s1    = tleLine1.Split(' ');
            string[] line1 = new string[9];
            int      count = 0;

            for (int i = 0; i < s1.Length; i++)
            {
                if (s1[i].Length > 0)
                {
                    line1[count] = s1[i];
                    count++;
                }
            }

            string sclass = line1[1].Substring(line1[1].Length - 1);

            if (sclass == "U")
            {
                satCl = 0x0;
            }
            if (sclass == "C")
            {
                satCl = 0x1;
            }
            if (sclass == "S")
            {
                satCl = 0x2;
            }

            noradId = line1[1].Remove(line1[1].Length - 1);

            //check if Line contains International Designator Information
            //if Not then skip setting them
            int noID = 0;

            if (count == 8)
            {
                noID = -1;
            }
            else
            {
                startYear   = Convert.ToInt32(line1[2].Substring(0, 2));
                startNumber = Convert.ToInt32(line1[2].Substring(2, 3));
                intDes      = line1[2].Substring(5);
            }

            epochYear = Convert.ToInt32(line1[3 + noID].Substring(0, 2));
            string epDay = line1[3 + noID].Substring(2);

            epochDay = double.Parse(epDay, CultureInfo.GetCultureInfo("en-US"));

            firstMeanMotion = double.Parse(line1[4 + noID], CultureInfo.GetCultureInfo("en-US"));

            int zeros = Convert.ToInt32(line1[5 + noID].Substring(line1[5].Length - 1));

            line1[5 + noID] = line1[5 + noID].Substring(0, line1[5 + noID].IndexOf('-'));
            if (line1[5 + noID].Length > 0)
            {
                if (line1[5 + noID][0] == '+' || line1[5 + noID][0] == '-')
                {
                    line1[5 + noID] = line1[5 + noID].Insert(1, ".");
                    for (int i = 0; i < zeros; i++)
                    {
                        line1[5 + noID] = line1[5 + noID].Insert(2, "0");
                    }
                }
                else
                {
                    line1[5 + noID] = line1[5 + noID].Insert(0, ".");
                    for (int i = 0; i < zeros; i++)
                    {
                        line1[5 + noID] = line1[5 + noID].Insert(1, "0");
                    }
                }
                secondMeanMotion = double.Parse(line1[5 + noID], CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                secondMeanMotion = 0.0;
            }

            zeros = Convert.ToInt32(line1[6 + noID].Substring(line1[6 + noID].Length - 1));
            if (line1[6 + noID][line1[6 + noID].Length - 2] == '-')
            {
                line1[6 + noID] = line1[6 + noID].Substring(0, line1[6 + noID].IndexOf('-'));
            }
            else
            {
                line1[6 + noID] = line1[6 + noID].Substring(0, line1[6 + noID].IndexOf('+'));
            }
            if (line1[6 + noID].Length > 0)
            {
                if (line1[6 + noID][0] == '+' || line1[6 + noID][0] == '-')
                {
                    line1[6 + noID] = line1[6 + noID].Insert(1, ".");
                    for (int i = 0; i < zeros; i++)
                    {
                        line1[6 + noID] = line1[6 + noID].Insert(2, "0");
                    }
                }
                else
                {
                    line1[6 + noID] = line1[6 + noID].Insert(0, ".");
                    for (int i = 0; i < zeros; i++)
                    {
                        line1[6 + noID] = line1[6 + noID].Insert(1, "0");
                    }
                }
                dragTerm = double.Parse(line1[6 + noID], CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                dragTerm = 0.0;
            }

            ephemeris = double.Parse(line1[7 + noID], CultureInfo.GetCultureInfo("en-US"));

            //check if Element Setnumber is included in TLE line
            //if not then there is only Checksum here
            if (line1[8 + noID].Length > 1)
            {
                setNumber = Convert.ToInt32(line1[8 + noID].Substring(0, line1[8 + noID].Length - 1));
                checksum1 = Convert.ToInt32(line1[8 + noID].Substring(line1[8 + noID].Length - 1));
            }
            else
            {
                checksum1 = Convert.ToInt32(line1[8 + noID]);
            }

            int    satNumber;
            double inclination;
            double rightAscension;
            double eccentricity;
            double perigee;
            double meanAnomoly;
            double meanMotion;
            double relevationNumber = 0;
            int    checksum2        = 0;

            //Start Line2

            string[] s2    = tleLine2.Split(' ');
            string[] line2 = new string[9];
            count = 0;
            for (int i = 0; i < s2.Length; i++)
            {
                if (s2[i].Length > 0)
                {
                    line2[count] = s2[i];
                    count++;
                }
            }

            satNumber      = Convert.ToInt32(line2[1]);
            inclination    = double.Parse(line2[2], CultureInfo.GetCultureInfo("en-US"));
            rightAscension = double.Parse(line2[3], CultureInfo.GetCultureInfo("en-US"));
            line2[4]       = line2[4].Insert(0, ".");
            eccentricity   = double.Parse(line2[4], CultureInfo.GetCultureInfo("en-US"));
            perigee        = double.Parse(line2[5], CultureInfo.GetCultureInfo("en-US"));
            meanAnomoly    = double.Parse(line2[6], CultureInfo.GetCultureInfo("en-US"));
            if (line2[8] != null)
            {
                meanMotion       = double.Parse(line2[7], CultureInfo.GetCultureInfo("en-US"));
                checksum2        = Convert.ToInt32(line2[8].Substring(line2[8].Length - 1));
                relevationNumber = double.Parse(line2[8].Substring(0, line2[8].Length - 1),
                                                CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                checksum2  = Convert.ToInt32(line2[7].Substring(line2[7].Length - 1));
                meanMotion = double.Parse(line2[7].Substring(0, 11),
                                          CultureInfo.GetCultureInfo("en-US"));
                relevationNumber = double.Parse(line2[7].Substring(11, 5),
                                                CultureInfo.GetCultureInfo("en-US"));
            }

            if (tleName == null)
            {
                tleName = startYear + startNumber + intDes;
            }
            if (tleName[0] == '0' && tleName[1] == ' ')
            {
                tleName = tleName.Remove(0, 2);
            }

            Tle ret = new Tle(tleName, noradId, (Enum.satClass)satCl, startYear, startNumber, intDes,
                              epochYear, epochDay, firstMeanMotion, secondMeanMotion, dragTerm,
                              ephemeris, setNumber, checksum1, satNumber, inclination, rightAscension,
                              eccentricity, perigee, meanAnomoly, meanMotion, relevationNumber, checksum2);

            return(ret);
        }
示例#6
0
        public bool runThisRun()
        {
            results = new List <string>();
            DataBase.DataBase db = new DataBase.DataBase();
            bool status          = true;
            List <Ground.Station> stationData = new List <Ground.Station>();

            for (int i = 0; i < stationList.Count; i++)
            {
                Ground.Station station = db.getStationFromDB(stationList[i]);
                stationData.Add(station);
                //updateLog(logfile, "Adding Station: " + station.getName());
            }
            System.Windows.Forms.Application.DoEvents();
            List <One_Sgp4.Tle> tleData = new List <Tle>();

            for (int i = 0; i < satelliteList.Count; i++)
            {
                One_Sgp4.Tle sattle = db.getTleDataFromDB(satelliteList[i]);
                tleData.Add(sattle);
                //updateLog(logfile, "Adding Satellite: " + sattle.getName());
            }
            System.Windows.Forms.Application.DoEvents();
            ContactWindowsVector contactsVector = MainFunctions2.calculateContactWindows(tleData, stationData, startTime, stopTime);

            System.Windows.Forms.Application.DoEvents();
            scheduler = null;
            switch (schedulerName)
            {
            case "Genetic":
                string[] settString = settings.Split(';');
                scheduler = new GeneticScheduler(Convert.ToInt32(settString[0]), Convert.ToInt32(settString[1]),
                                                 Convert.ToInt32(settString[2]), Convert.ToInt32(settString[4]), Convert.ToBoolean(settString[5]),
                                                 Convert.ToDouble(settString[6]), Convert.ToBoolean(settString[7]), Convert.ToBoolean(settString[8]));
                break;

            case "Greedy":
                scheduler = new GreedyScheduler();
                break;

            case "EFT-Greedy":
                scheduler = new EftGreedyScheduler();
                break;

            case "Hill-Climber":
                string[] settString2 = settings.Split(';');
                scheduler = new HillClimberScheduler(Convert.ToBoolean(settString2[0]), Convert.ToBoolean(settString2[2]),
                                                     Convert.ToInt32(settString2[1]));
                break;
            }
            ObjectiveFunction objective = new ObjectiveFunction(Forms.ObjectiveBuilderForm.getObjectiveEnumsByName(objectiveFunction));

            System.Windows.Forms.Application.DoEvents();
            SchedulingProblem problem = new SchedulingProblem();

            problem.setContactWindows(contactsVector);
            problem.removeUnwantedContacts(Properties.Settings.Default.orbit_Minimum_Contact_Duration_sec);
            problem.setObjectiveFunction(objective);
            problem.getContactWindows().randomize(Properties.Settings.Default.global_Random_Seed);
            getScenario(problem, scenario);
            System.Windows.Forms.Application.DoEvents();
            TimeMeasurement tm = new TimeMeasurement();

            tm.activate();
            scheduler.CalculateSchedule(problem);
            string time = tm.getValueAndDeactivate();

            System.Windows.Forms.Application.DoEvents();
            contactsVector = scheduler.getFinischedSchedule();
            System.Windows.Forms.Application.DoEvents();


            if (scheduler != null)
            {
                ObjectiveFunction objfunc = scheduler.getObjectiveFunction();
                if (objfunc == null)
                {
                    objfunc = new ObjectiveFunction();
                }
                objfunc.calculateValues(scheduler.getFinischedSchedule());

                double fitness = objfunc.getObjectiveResults();

                int    _H  = scheduler.getFinischedSchedule().getNrOfScheduled();
                double _H1 = objfunc.getScheduledContactsValue();
                int    _H2 = GeneralMeasurments.getNrOfConflicts(scheduler.getFinischedSchedule());
                double _H3 = objfunc.getStationFairnessValue();
                double _H4 = objfunc.getSatelliteFairnessValue();
                double _H5 = GeneralMeasurments.getDurationOfScheduledContacts(scheduler.getFinischedSchedule());

                results.Add("Run: " + schedulerName);
                results.Add("Fitness Value:" + objfunc.getObjectiveResults().ToString());
                results.Add("Scheduled Contacts: " + scheduler.getFinischedSchedule().getNrOfScheduled().ToString() + " / " + contactsVector.Count().ToString());
                results.Add("Collisions: " + GeneralMeasurments.getNrOfConflicts(scheduler.getFinischedSchedule()).ToString());
                results.Add("Fairnes Stations: " + objfunc.getStationFairnessValue().ToString());
                results.Add("Fairnes Satellites: " + objfunc.getSatelliteFairnessValue().ToString());
                results.Add("Duration: " + GeneralMeasurments.getDurationOfScheduledContacts(scheduler.getFinischedSchedule()).ToString() + " sec.");
                results.Add("Calculation Time: " + time);
                results.Add("Scheduled By Priority: " + GeneralMeasurments.getNrOfPrioritysScheduled(scheduler.getFinischedSchedule()));
                results.Add("Scheduled UWE-3: " + GeneralMeasurments.getNrOfUweContacts(scheduler.getFinischedSchedule()).ToString());

                //Log.writeResults(logfile, schedulerName, results);
                if (results == null)
                {
                    status = false;
                }
            }
            else
            {
                status = false;
            }
            cancel = false;
            return(status);
        }
示例#7
0
 //! clear all Data.
 /*!
     clears all calculated and stored data
 */
 public void clear()
 {
     resultOrbitData.Clear();
     resultOrbitData = null;
     tleElementData = null;
     satCalcData.dso = null;
     satCalcData.neo = null;
     satCalcData = null;
 }
示例#8
0
        //! SGP4 constructor.
        /*!
        \param tle Two Line Elements
        \param int GravConst 0 = WGS72, 1 = WGS82
        initializes the Orbit-Calculation model
        */
        public Sgp4(Tle data, int wgsConstant)
        {
            setGrav(wgsConstant);

            tleElementData = data;
            satCalcData = new Sgp4Rec();

            resultOrbitData = new List<Sgp4Data>();

            //Load TLE Data in sg4Rec Class for calculation
            satCalcData.rec_satnum = data.getSatNumber();
            satCalcData.rec_epochyr = data.getEpochYear();
            satCalcData.rec_epochdays = data.getEpochDay();
            satCalcData.rec_bstar = data.getDrag();
            satCalcData.rec_inclo = data.getInclination();
            satCalcData.rec_omegao = data.getRightAscendingNode();
            satCalcData.rec_ecco = data.getEccentriciy();
            satCalcData.rec_argpo = data.getPerigee();
            satCalcData.rec_mo = data.getMeanAnomoly();
            satCalcData.rec_no = data.getMeanMotion();

            satCalcData.rec_no = satCalcData.rec_no / xpdotp;

            satCalcData.rec_a = Math.Pow(satCalcData.rec_no * tumin, (-2.0 / 3.0));
            satCalcData.rec_ndot = satCalcData.rec_ndot / (xpdotp * 1440.0);
            satCalcData.rec_nddot = satCalcData.rec_nddot / (xpdotp * 1440.0 * 1440);

            satCalcData.rec_inclo = satCalcData.rec_inclo / rad;
            satCalcData.rec_omegao = satCalcData.rec_omegao / rad;
            satCalcData.rec_argpo = satCalcData.rec_argpo / rad;
            satCalcData.rec_mo = satCalcData.rec_mo / rad;

            //Initalize newton rhapson iteration
            newtonm(satCalcData.rec_ecco, satCalcData.rec_mo, e1, nuo);

            satCalcData.rec_alta = satCalcData.rec_a *
                (1.0 + satCalcData.rec_ecco * satCalcData.rec_ecco) - 1.0;
            satCalcData.rec_altp = satCalcData.rec_a *
                (1.0 - satCalcData.rec_ecco * satCalcData.rec_ecco) - 1.0;

            //check Yeahr to find the the right Date
            //Currently will only work until 2058
            //Currently oldest man made object Vangard1 Launched 1958
            if (satCalcData.rec_epochyr < 58)
                year = satCalcData.rec_epochyr + 2000;
            else
                year = satCalcData.rec_epochyr + 1900;

            // Epoch time
            satCalcData.rec_eptime = (year - 1950) * 365 + (year - 1949) / 4
                    + satCalcData.rec_epochdays;

            EpochTime satTime = new EpochTime(satCalcData.rec_epochyr,
                satCalcData.rec_epochdays);

            satCalcData.rec_mjdsatepoch = satTime.toJulianDate();
            satCalcData.rec_mjdsatepoch = satCalcData.rec_mjdsatepoch - 2400000.5;

            satCalcData.rec_init = 1;
            satCalcData.neo.neo_t = 0.0;

            sgp4Init(satCalcData.rec_satnum, year, satCalcData.rec_mjdsatepoch - 33281.0);
            //end;
        }