Example #1
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);
        }
Example #2
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);
        }