// ///////////////////////////////////////////////////////////////////// static void Main(string[] args) { // Sample obsCodeode to test the SGP4 and SDP4 implementation. The test // TLEs come from the NORAD document "Space Track Report No. 3". // Test SGP4 string str1 = "SGP4 Test"; string str2 = "1 88888U 80275.98708465 .00073094 13844-3 66816-4 0 8"; string str3 = "2 88888 72.8435 115.9689 0086731 52.6988 110.5714 16.05824518 105"; TwoLineElement tle1 = new TwoLineElement(str1, str2, str3); PrintPosVel(tle1); Console.WriteLine(); // Test SDP4 str1 = "SDP4 Test"; str2 = "1 11801U 80230.29629788 .01431103 00000-0 14311-1 8"; str3 = "2 11801 46.7916 230.4354 7318036 47.4722 10.4117 2.28537848 6"; TwoLineElement tle2 = new TwoLineElement(str1, str2, str3); PrintPosVel(tle2); Console.WriteLine("\nExample output:"); // Example: Define a location on the earth, then determine the look-angle // to the SDP4 satellite defined above. // Create an orbit object using the SDP4 TLE object. // Satellite satSDP4 = new Satellite(tle2); Orbit orbit = new Orbit(tle2); // Get the location of the satellite from the Orbit object. The // earth-centered inertial information is placed into eciSDP4. // Here we ask for the location of the satellite 90 minutes after // the TLE epoch. TimedMotionState eciSDP4 = orbit.PositionEci(90.0); // Now create a site object. Site objects represent a location on the // surface of the earth. Here we arbitrarily select a point on the // equator. GeoCoord siteEquator = new GeoCoord(0.0, -100.0, 0); // 0.00 N, 100.00 W, 0 km altitude // Now get the "look angle" from the site to the satellite. // Note that the ECI object "eciSDP4" has a time associated // with the coordinates it contains; this is the time at which // the look angle is valid. TopoCoord topoLook = OrbitUtils.GetSatTopoCoord(eciSDP4, siteEquator); // Print out the results. Note that the Azimuth and Elevation are // stored in the CoordTopo object as radians. Here we funcKeyToDouble // to degrees using Rad2Deg() Console.Write("AZ: {0:f3} EL: {1:f3}\n", topoLook.Azimuth, topoLook.Elevation); }
private void button_radarCaculate_Click(object sender, EventArgs e) { bool isGeoCoord = this.radioButton_geoCoord.Checked; GeoCoord siteCoord = null; if (isGeoCoord) { siteCoord = GeoCoord.Parse(this.textBox_coord.Text); siteCoord.Unit = AngleUnit.Degree; } else { XYZ xyz = XYZ.Parse(this.textBox_coord.Text); siteCoord = CoordTransformer.XyzToGeoCoord(xyz); } TwoLineElement tle = GetTwoLineElement(); Gnsser.Orbits.Orbit orbit = new Gnsser.Orbits.Orbit(tle); double intervalMin = Double.Parse(this.textBox_intervalMin.Text); double count = Int32.Parse(this.textBox_count.Text); lonlats = new List <AnyInfo.Geometries.Point>(); lonlats.Add(new AnyInfo.Geometries.Point(siteCoord, "SitePoint")); for (int i = 0; i < count; i++) { double time = i * intervalMin; TimedMotionState eciSDP4 = orbit.PositionEci(time); TopoCoord topoLook = OrbitUtils.GetSatTopoCoord(eciSDP4, siteCoord); if (topoLook.Elevation > 0) { GeoCoord geoCoord = CoordTransformer.XyzToGeoCoord(eciSDP4.Position * 1000, AngleUnit.Degree); lonlats.Add(new AnyInfo.Geometries.Point(geoCoord, i + "")); } } }
/// <summary> /// 根据卫星位置和测站位置计算其在站星坐标系中的位置。 /// Returns the topo-centric (azimuth, elevation, etc.) coordinates for /// a target object described by the given ECI coordinates. /// </summary> /// <param name="satPos">The ECI coordinates of the target object.</param> /// <param name="siteCoord">The ECI coordinates of the 观测站</param> /// <returns>The look angle to the target object.</returns> public static TopoCoord GetSatTopoCoord(TimedMotionState satPos, GeoCoord siteCoord) { // Calculate the ECI coordinates for this Site object at the time of interest. Julian date = satPos.Date; MotionState sitePos = OrbitUtils.GetMovingState(siteCoord, date); XYZ vecV = satPos.Velocity - sitePos.Velocity; XYZ vecP = satPos.Position - sitePos.Position; // The site's Local Mean Sidereal Time at the time of interest. double thetaRad = date.GetLocalMeanSiderealTime(siteCoord.Lon, false); double sinLat = Math.Sin(siteCoord.Lat); double cosLat = Math.Cos(siteCoord.Lat); double sinTheta = Math.Sin(thetaRad); double cosTheta = Math.Cos(thetaRad); double top_s = sinLat * cosTheta * vecP.X + sinLat * sinTheta * vecP.Y - cosLat * vecP.Z; double top_e = -sinTheta * vecP.X + cosTheta * vecP.Y; double top_z = cosLat * cosTheta * vecP.X + cosLat * sinTheta * vecP.Y + sinLat * vecP.Z; double az = Math.Atan(-top_e / top_s); if (top_s > 0.0) { az += OrbitConsts.PI; } if (az < 0.0) { az += 2.0 * OrbitConsts.PI; } double el = Math.Asin(top_z / vecP.Radius()); double rate = vecP.Dot(vecV) / vecP.Radius(); TopoCoord topo = new TopoCoord( az, // azimuth, radians el, // elevation, radians vecP.Radius(), // range rate // rate, per sec ); #if WANT_ATMOSPHERIC_CORRECTION // Elevation correction for atmospheric refraction. // Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 // Note: Correction is meaningless when apparent elevation is below horizon topo.Elevation += AngularConvert.DegToRad((1.02 / Math.Tan(AngularConvert.DegToRad(AngularConvert.RadToDeg(el) + 10.3 / (AngularConvert.RadToDeg(el) + 5.11)))) / 60.0); if (topo.Elevation < 0.0) { topo.Elevation = el; // Reset to true elevation } if (topo.Elevation > (Consts.PI / 2.0)) { topo.Elevation = (Consts.PI / 2.0); } #endif return(topo); }