private void ShowData() { if (tle != null) { var Location = new LatLon(53.9, 27.56667); var dt = DateTime.UtcNow; var JDdate = Utils.Utils.JDtime(dt); MJD.Text = JDdate.ToString("f5"); orbit = new Orbit(tle); Site site = new Site(Location.Lat, Location.Lon, 0.290); EciTime eci = orbit.GetPosition(dt); Topo topoLook = site.GetLookAngle(eci); main.Altitude.Text = topoLook.ElevationDeg.ToString("f3"); main.Azimuth.Text = topoLook.AzimuthDeg.ToString("f3"); var altAzm = new AltAzm(topoLook.ElevationDeg, topoLook.AzimuthDeg); var RaDec = Utils.Utils.AltAzm2RaDec(altAzm, Location, dt, 0.29); var tt2 = Utils.Utils.RaDec2AltAzm2( new Coordinates(16.695, 36.466667), new LatLon(52.5, -1.9166667), new DateTime(1998, 8, 10, 23, 10, 00), 0); var ttt = Utils.Utils.RaDec2AltAzm2(RaDec, Location, dt, 0.2); RA.Text = DMS.FromDeg(RaDec.Ra).ToString(); Dec.Text = DMS.FromDeg(RaDec.Dec).ToString(); } }
//Returns the azimuth and elevation from a TLE private double[] getSkyCoords(Tle tle) { double[] array = { -1, -1 }; //create a viewing site Site site = new Site(latitude, longitude, 0.240949); //make an orbit out of the tle Orbit orbit = new Orbit(tle); //get the date DateTime dt = DateTime.UtcNow; //get the time since the epoch TimeSpan ts = orbit.TPlusEpoch(dt); //then calculate the position try { EciTime eci = orbit.GetPosition(dt); Topo topoLook = site.GetLookAngle(eci); array[0] = topoLook.AzimuthDeg; array[1] = topoLook.ElevationDeg; return(array); } catch { return(array); } }
// ///////////////////////////////////////////////////////////////////// static void Main(string[] args) { // Sample code 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"; Tle tle1 = new Tle(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"; Tle tle2 = new Tle(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); // 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. EciTime eciSDP4 = satSDP4.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. Site siteEquator = new Site(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. Topo topoLook = siteEquator.GetLookAngle(eciSDP4); // Print out the results. Note that the Azimuth and Elevation are // stored in the CoordTopo object as radians. Here we convert // to degrees using Rad2Deg() Console.Write("AZ: {0:f3} EL: {1:f3}\n", topoLook.AzimuthDeg, topoLook.ElevationDeg); }
/// <summary> /// Processes TLE data through SDP4/SGP4. /// </summary> /// <param name="tle">TLE Data (2 lines + name as line 0)</param> /// <param name="utc">Date to interpolate to, in UTC.</param> public void ProcessTLE(string[] tle, DateTime utc) { Satellite sat = new Satellite(new Tle(tle[0], tle[1], tle[2])); EciTime eci = sat.PositionEci(utc); RPos = eci.Position; RVel = eci.Velocity; RVel *= -1; Name = tle[0]; }
private void showSatInfo() { //to update the info on the sidebar try { satNameLabel.Text = Target.Name; while (satNameLabel.Width < System.Windows.Forms.TextRenderer.MeasureText(satNameLabel.Text, new Font(satNameLabel.Font.FontFamily, satNameLabel.Font.Size, satNameLabel.Font.Style)).Width) { satNameLabel.Font = new Font(satNameLabel.Font.FontFamily, satNameLabel.Font.Size - 0.5f, satNameLabel.Font.Style); } while (satNameLabel.Width > System.Windows.Forms.TextRenderer.MeasureText(satNameLabel.Text, new Font(satNameLabel.Font.FontFamily, satNameLabel.Font.Size, satNameLabel.Font.Style)).Width) { satNameLabel.Font = new Font(satNameLabel.Font.FontFamily, satNameLabel.Font.Size + 0.5f, satNameLabel.Font.Style); } } catch (ArgumentException) { Console.WriteLine("wat"); } Orbit orbit = new Orbit(Target); //get the date DateTime dt = DateTime.UtcNow; //get the time since the epoch TimeSpan ts = orbit.TPlusEpoch(dt); //then calculate the position EciTime eci = orbit.GetPosition(dt); /* * double e = double.Parse(Target.Eccentricity, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture); * double meanMotion = Convert.ToDouble(Target.Line2.Substring(52, 10)); * double twothirds = 0.666666666666666; * double a = 6.6228 / (Math.Pow(meanMotion, twothirds)); * double semimajor = a * 6371.1; * double apogee = (semimajor * (1.0 + e) - 6371.1); * double perigee = (semimajor * (1.0 - e) - 6371.1); */ designatorLabel.Text = "Int'l Des: " + Target.IntlDescription; apogeeLabel.Text = "Apogee: " + orbit.Apogee.ToString("0.0") + "km"; perigeeLabel.Text = "Perigee: " + orbit.Perigee.ToString("0.0") + "km"; inclinationLabel.Text = "Inclination: " + Target.Inclination; }