Exemplo n.º 1
0
        //! Calculate Range, Azimuth and elevation for satellite
        //! for given time point and satellite position

        /*!
         *  \param Station to calcuate if satellite is in View
         *  \param TimeDate start time
         *  \param List<Sgp4Data> satellite position vector
         *  \return Point3d containing range(km), azimuth(degrees), elevation(degrees)
         */
        public static Point3d calcSphericalCoordinate(Coordinate coordinate,
                                                      EpochTime time, Sgp4Data satPosData)
        {
            double lsr = time.getLocalSiderealTime(coordinate.getLongitude());

            Point3d groundLocation = coordinate.toECI(lsr);
            Point3d result         = new Point3d();

            Point3d r = new Point3d();

            r.x = satPosData.getX() - groundLocation.x;
            r.y = satPosData.getY() - groundLocation.y;
            r.z = satPosData.getZ() - groundLocation.z;

            double r_lat = coordinate.getLatetude() * toRadians;

            double sin_lat   = Math.Sin(r_lat);
            double cos_lat   = Math.Cos(r_lat);
            double sin_theta = Math.Sin(lsr);
            double cos_theta = Math.Cos(lsr);

            double rs = sin_lat * cos_theta * r.x + sin_lat * sin_theta * r.y - cos_lat * r.z;
            double re = -sin_theta * r.x + cos_theta * r.y;
            double rz = cos_lat * cos_theta * r.x + cos_lat * sin_theta * r.y + sin_lat * r.z;

            result.x = Math.Sqrt((rs * rs) + (re * re) + (rz * rz));
            result.y = AcTan(-re, rs);
            result.z = Math.Asin(rz / result.x);

            result.y = (result.y + pi) * toDegrees;
            result.z = result.z * toDegrees;

            return(result);
        }
Exemplo n.º 2
0
        //! Calculate Latitude, longitude and height for satellite on Earth
        //! at given time point and position of the satellite

        /*!
         *  \param TimeDate start time
         *  \param List<Sgp4Data> satellite position vector
         *  \param int WGS-Data to use 0 = WGS_72; 1 = WGS_84
         *  \param int Nr of iterations used to calculate the latetude
         *  \return Coordinate containing longitude, latitude, altitude/height
         */
        public static Coordinate calcSatSubPoint(EpochTime time, Sgp4Data satPosData,
                                                 One_Sgp4.Sgp4.wgsConstant wgs)
        {
            double sat_X = satPosData.getX();
            double sat_Y = satPosData.getY();
            double sat_Z = satPosData.getZ();

            double f     = WGS_72.f;
            double wgs_R = WGS_72.radiusEarthKM;

            if (wgs == Sgp4.wgsConstant.WGS_84)
            {
                f     = WGS_84.f;
                wgs_R = WGS_84.radiusEarthKM;
            }
            double delta = 1.0e-07;
            double f_2   = f * f;
            double e     = 2 * f - f_2;

            double r        = Math.Sqrt((sat_X * sat_X) + (sat_Y * sat_Y));
            double latitude = AcTan(sat_Z, r);
            double c        = 1.0;
            double height   = 0.0;

            double phi;

            do
            {
                phi      = latitude;
                c        = 1.0 / (Math.Sqrt(1.0 - e * (Math.Sin(latitude) * Math.Sin(latitude))));
                latitude = AcTan(sat_Z + (wgs_R * c * e * Math.Sin(latitude)), r);
            }while (Math.Abs(latitude - phi) > delta);

            double longitude = AcTan(sat_Y, sat_X) - time.getLocalSiderealTime();

            height = (r / Math.Cos(latitude)) - (wgs_R * c);

            if (longitude < pi)
            {
                longitude += twoPi;
            }
            if (longitude > pi)
            {
                longitude -= twoPi;
            }

            latitude  = toDegrees * latitude;
            longitude = toDegrees * longitude;

            return(new Coordinate(latitude, longitude, height));
        }
Exemplo n.º 3
0
        //! Calculate visibility of a satellite from a point on Earth

        /*!
         *  \param Station to calcuate if satellite is in View
         *  \param TimeDate start time
         *  \param List<Sgp4Data> satellite position vector
         *  \param string name of the satellite
         *  \param double tick in witch time is increased by each step
         *  \return true if object is visible at given time and current location
         */
        public static bool isSatVisible(Coordinate coordinate,
                                        double minElevation, EpochTime time, Sgp4Data satPosData)
        {
            double  lsr            = time.getLocalSiderealTime(coordinate.getLongitude());
            Point3d groundLocation = coordinate.toECI(lsr);

            Point3d v = new Point3d();

            v.x = satPosData.getX() - groundLocation.x;
            v.y = satPosData.getY() - groundLocation.y;
            v.z = satPosData.getZ() - groundLocation.z;

            double r_lat = coordinate.getLatetude() * toRadians;

            double sin_lat = Math.Sin(r_lat);
            double cos_lat = Math.Cos(r_lat);
            double sin_srt = Math.Sin(lsr);
            double cos_srt = Math.Cos(lsr);


            double rs = sin_lat * cos_srt * v.x
                        + sin_lat * sin_srt * v.y
                        - cos_lat * v.z;
            double re = -sin_srt * v.x
                        + cos_srt * v.y;
            double rz = cos_lat * cos_srt * v.x
                        + cos_lat * sin_srt * v.y + sin_lat * v.z;

            double range     = Math.Sqrt(rs * rs + re * re + rz * rz);
            double elevation = Math.Asin(rz / range);
            double azimuth   = Math.Atan(-re / rs);

            if (rs > 0.0)
            {
                azimuth += pi;
            }
            if (azimuth < 0.0)
            {
                azimuth += twoPi;
            }

            if (elevation >= minElevation)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        //! Calculate Range, Azimuth and elevation for satellite
        //! for given time point and satellite position

        /*!
         *  \param Station to calcuate if satellite is in View
         *  \param TimeDate start time
         *  \param List<Sgp4Data> satellite position vector
         *  \return Point3d containing range, azimuth, elevation
         */
        public static Point3d calcSphericalCoordinate(Coordinate coordinate,
                                                      EpochTime time, Sgp4Data satPosData)
        {
            double  lsr            = time.getLocalSiderealTime(coordinate.getLongitude());
            Point3d groundLocation = coordinate.toECI(lsr);
            Point3d result         = new Point3d();

            Point3d v = new Point3d();

            v.x = satPosData.getX() - groundLocation.x;
            v.y = satPosData.getY() - groundLocation.y;
            v.z = satPosData.getZ() - groundLocation.z;

            double r_lat = coordinate.getLatetude() * toRadians;

            double sin_lat = Math.Sin(r_lat);
            double cos_lat = Math.Cos(r_lat);
            double sin_srt = Math.Sin(lsr);
            double cos_srt = Math.Cos(lsr);


            double rs = sin_lat * cos_srt * v.x
                        + sin_lat * sin_srt * v.y
                        - cos_lat * v.z;
            double re = -sin_srt * v.x
                        + cos_srt * v.y;
            double rz = cos_lat * cos_srt * v.x
                        + cos_lat * sin_srt * v.y + sin_lat * v.z;

            result.x = Math.Sqrt(rs * rs + re * re + rz * rz);
            result.y = Math.Atan(-re / rs);
            result.z = Math.Asin(rz / result.x);

            if (rs > 0.0)
            {
                result.y += pi;
            }
            if (result.y < 0.0)
            {
                result.y += twoPi;
            }

            return(result);
        }
Exemplo n.º 5
0
        //! Calculate Latitude, longitude and height for satellite on Earth
        //! at given time point and position of the satellite

        /*!
         *  \param TimeDate start time
         *  \param List<Sgp4Data> satellite position vector
         *  \param int WGS-Data to use 0 = WGS_72; 1 = WGS_84
         *  \param int Nr of iterations used to calculate the latetude
         *  \return Coordinate containing longitude, latitude, altitude/height
         */
        public static Coordinate calcSatSubPoint(EpochTime time, Sgp4Data satPosData,
                                                 int wgsID = 0)
        {
            double sat_X = satPosData.getX();
            double sat_Y = satPosData.getY();
            double sat_Z = satPosData.getZ();

            //calculat Longitude
            double latitude = Math.Atan((sat_Z / (Math.Sqrt(
                                                      sat_X * sat_X + sat_Y * sat_Y))));

            double longitude = AcTan(sat_Y, sat_X) - time.getLocalSiderealTime();
            double height    = Math.Sqrt(sat_X * sat_X + sat_Y * sat_Y + sat_Z * sat_Z) - 6378.135;

            latitude  = toDegrees * latitude;
            longitude = toDegrees * longitude;

            return(new Coordinate(latitude, longitude, height));
        }
Exemplo n.º 6
0
        //! Calculate Latitude, longitude and height for satellite on Earth
        //! at given time point and position of the satellite
        /*!
            \param TimeDate start time
            \param List<Sgp4Data> satellite position vector
            \param int WGS-Data to use 0 = WGS_72; 1 = WGS_84
            \param int Nr of iterations used to calculate the latetude
            \return Coordinate containing longitude, latitude, altitude/height
        */
        public static Coordinate calcSatSubPoint(EpochTime time, Sgp4Data satPosData,
            int wgsID = 0)
        {
            double sat_X = satPosData.getX();
            double sat_Y = satPosData.getY();
            double sat_Z = satPosData.getZ();

            //calculat Longitude
            double latitude = Math.Atan((sat_Z / (Math.Sqrt(
                                sat_X * sat_X + sat_Y * sat_Y))));

            double longitude = AcTan(sat_Y, sat_X) - time.getLocalSiderealTime();
            double height = Math.Sqrt(sat_X * sat_X + sat_Y * sat_Y + sat_Z * sat_Z) - 6378.135;

            latitude = toDegrees * latitude;
            longitude = toDegrees * longitude;

            return new Coordinate(latitude, longitude, height);
        }
Exemplo n.º 7
0
        //! Calculate visibility of a satellite from a point on Earth
        /*!
            \param Station to calcuate if satellite is in View
            \param TimeDate start time
            \param List<Sgp4Data> satellite position vector
            \param string name of the satellite
            \param double tick in witch time is increased by each step
            \return true if object is visible at given time and current location
        */
        public static bool isSatVisible(Coordinate coordinate, 
            double minElevation, EpochTime time, Sgp4Data satPosData)
        {
            double lsr = time.getLocalSiderealTime(coordinate.getLongitude());
                Point3d groundLocation = coordinate.toECI(lsr);

                Point3d v = new Point3d();
                v.x = satPosData.getX() - groundLocation.x;
                v.y = satPosData.getY() - groundLocation.y;
                v.z = satPosData.getZ() - groundLocation.z;

                double r_lat = coordinate.getLatetude() * toRadians;

                double sin_lat = Math.Sin(r_lat);
                double cos_lat = Math.Cos(r_lat);
                double sin_srt = Math.Sin(lsr);
                double cos_srt = Math.Cos(lsr);

                double rs = sin_lat * cos_srt * v.x
                          + sin_lat * sin_srt * v.y
                          - cos_lat * v.z;
                double re = - sin_srt * v.x
                            + cos_srt * v.y;
                double rz = cos_lat * cos_srt * v.x
                            + cos_lat * sin_srt * v.y + sin_lat * v.z;

                double range = Math.Sqrt(rs * rs + re * re + rz * rz);
                double elevation = Math.Asin(rz / range);
                double azimuth = Math.Atan(-re / rs);

                if (rs > 0.0)
                {
                    azimuth += pi;
                }
                if (azimuth < 0.0)
                {
                    azimuth += twoPi;
                }

                if (elevation >= minElevation)
                {
                    return true;
                }
                else
                {
                    return false;
                }
        }
Exemplo n.º 8
0
        //! Calculate Range, Azimuth and elevation for satellite
        //! for given time point and satellite position
        /*!
            \param Station to calcuate if satellite is in View
            \param TimeDate start time
            \param List<Sgp4Data> satellite position vector
            \return Point3d containing range, azimuth, elevation
        */
        public static Point3d calcSphericalCoordinate(Coordinate coordinate,
            EpochTime time, Sgp4Data satPosData)
        {
            double lsr = time.getLocalSiderealTime(coordinate.getLongitude());
            Point3d groundLocation = coordinate.toECI(lsr);
            Point3d result = new Point3d();

            Point3d v = new Point3d();
            v.x = satPosData.getX() - groundLocation.x;
            v.y = satPosData.getY() - groundLocation.y;
            v.z = satPosData.getZ() - groundLocation.z;

            double r_lat = coordinate.getLatetude() * toRadians;

            double sin_lat = Math.Sin(r_lat);
            double cos_lat = Math.Cos(r_lat);
            double sin_srt = Math.Sin(lsr);
            double cos_srt = Math.Cos(lsr);

            double rs = sin_lat * cos_srt * v.x
                      + sin_lat * sin_srt * v.y
                      - cos_lat * v.z;
            double re = -sin_srt * v.x
                        + cos_srt * v.y;
            double rz = cos_lat * cos_srt * v.x
                        + cos_lat * sin_srt * v.y + sin_lat * v.z;

            result.x = Math.Sqrt(rs * rs + re * re + rz * rz);
            result.y = Math.Atan(-re / rs);
            result.z = Math.Asin(rz / result.x);

            if (rs > 0.0)
            {
                result.y += pi;
            }
            if (result.y < 0.0)
            {
                result.y += twoPi;
            }

            return result;
        }