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(); } }
public void GetPasses(Site observer, Orbit orbit, DateTime start) { int passesRequired = 2; int totalPassesFound = 0; DateTime calcTime = start; Hashtable passes = new Hashtable(); EciTime eci; Topo topoLook; Pass pass; orbit.HasAOS(observer); while (totalPassesFound < passesRequired) { eci = orbit.GetPosition(calcTime); CoordGeo a = eci.ToGeo(); topoLook = observer.GetLookAngle(eci); if (topoLook.ElevationDeg > 0) { pass = new Pass(); pass.AOS = calcTime; pass.AOSAz = topoLook.AzimuthDeg; while (topoLook.ElevationDeg > 0) { eci = orbit.GetPosition(calcTime); topoLook = observer.GetLookAngle(eci); if (topoLook.ElevationDeg > pass.MaxEl) { pass.MaxEl = topoLook.ElevationDeg; } calcTime = calcTime.AddSeconds(1); pass.LOS = calcTime; } pass.LOSAz = topoLook.AzimuthDeg; //passes.Add(pass); totalPassesFound++; } calcTime = calcTime.AddSeconds(20); } //return passes; }
public static void Main() { string str1 = "ISS (ZARYA) "; string str2 = "1 25544U 98067A 13222.08683053 .00004563 00000-0 87202-4 0 3628"; string str3 = "2 25544 51.6485 201.2720 0004128 298.2475 180.8024 15.50224716843064"; Tle tle1 = new Tle(str1, str2, str3); Site siteEquator = new Site(52.1259155, -0.219355, 0); Orbit orbit = new Orbit(tle1); DateTime now = DateTime.Now; Track t = new Track(); t.GetPasses(siteEquator, orbit, DateTime.Now); while (true) { EciTime eciSDP4 = orbit.GetPosition(DateTime.Now); Topo topoLook = siteEquator.GetLookAngle(eciSDP4); CoordGeo g = eciSDP4.ToGeo(); Debug.Print(g.Latitude.ToString() + " " + g.Longitude.ToString() + " " + g.Altitude.ToString()); Thread.Sleep(1000); } }
void TimerTick(Timer timer) { string str1 = "ISS (ZARYA) "; string str2 = "1 25544U 98067A 15352.54319571 .00014358 00000-0 21741-3 0 9990"; string str3 = "2 25544 51.6437 244.0274 0008333 295.0996 127.4199 15.54892795976727"; Tle tle1 = new Tle(str1, str2, str3); Site siteEquator = new Site(52.454935, 0.201279, 0); Orbit orbit = new Orbit(tle1); DateTime now = DateTime.Now; EciTime eciSDP4 = orbit.GetPosition(now); Topo topoLook = siteEquator.GetLookAngle(eciSDP4); CoordGeo coords = eciSDP4.ToGeo(); UpdateTextBlock(RealTimeClock.GetDateTime().ToString(@"dd\/MM\/yyyy HH:mm"), "date"); UpdateTextBlock(coords.Altitude.ToString("F2"), "satAlt"); UpdateTextBlock(coords.Latitude.ToString("F2"), "satLat"); UpdateTextBlock((360 - coords.Longitude).ToString("F2"), "satLon"); UpdateTextBlock(topoLook.AzimuthDeg.ToString("F2"), "satAz"); UpdateTextBlock(topoLook.ElevationDeg.ToString("F2"), "satEl"); }
/// <summary> /// 计算DOP值,返回可见卫星数 /// </summary> /// <param name="tle"></param> /// <param name="time">要计算的时间</param> /// <param name="B">测站的,单位:度</param> /// <param name="L"></param> /// <param name="H">单位:米</param> /// <param name="cor_limit">截止高度角,度</param> /// <param name="GDOP"></param> /// <param name="PDOP"></param> /// <param name="HDOP"></param> /// <param name="VDOP"></param> /// <param name="TDOP"></param> /// <returns></returns> public static int CalcDops(Tle[] tles, DateTime time, double B, double L, double H, double cor_limit, ref double GDOP, ref double PDOP, ref double HDOP, ref double VDOP, ref double TDOP) { double x2 = 0; double y2 = 0; double z2 = 0; //测站坐标 BLToXYZ(B / 180 * Math.PI, L / 180 * Math.PI, H, ref x2, ref y2, ref z2); ArrayList temp = new ArrayList(); Site siteEquator2 = new Site(B, L, H); Tle tle; Orbit orbit; Eci eci; CoordGeo cg; int sum = 0; for (int i = 0; i < tles.Length; i++) { tle = tles[i]; orbit = new Orbit(tle); eci = orbit.GetPosition(time); double x = eci.Position.X * 1000; double y = eci.Position.Y * 1000; double z = eci.Position.Z * 1000; //化成米 cg = eci.ToGeo(); CoordTopo topoLook = siteEquator2.GetLookAngle(eci); topoLook.Elevation = Globals.Rad2Deg(topoLook.Elevation); topoLook.Azimuth = Globals.Rad2Deg(topoLook.Azimuth); //化成度 if (topoLook.Elevation > cor_limit) { sum++; double d_x = x - x2; double d_y = y - y2; double d_z = z - z2; double r2 = Math.Sqrt(d_x * d_x + d_y * d_y + d_z * d_z); temp.Add(d_x / r2); temp.Add(d_y / r2); temp.Add(d_z / r2); } } NNMatrix Q = new NNMatrix(sum, 4); NNMatrix Q_x = new NNMatrix(4, 4); for (int j = 0; j < temp.Count; j++) { if ((j + 1) % 3 == 1) { Q.Matrix[j / 3, 0] = (double)temp[j]; } else if ((j + 1) % 3 == 2) { Q.Matrix[j / 3, 1] = (double)temp[j]; } else if ((j + 1) % 3 == 0) { Q.Matrix[j / 3, 2] = (double)temp[j]; } Q.Matrix[j / 3, 3] = 1; } Q_x = NNMatrix.Invers(NNMatrix.Transpos(Q) * Q); GDOP = Math.Sqrt(Q_x.Matrix[0, 0] + Q_x.Matrix[1, 1] + Q_x.Matrix[2, 2] + Q_x.Matrix[3, 3]); PDOP = Math.Sqrt(Q_x.Matrix[0, 0] + Q_x.Matrix[1, 1] + Q_x.Matrix[2, 2]); HDOP = Math.Sqrt(Q_x.Matrix[0, 0] + Q_x.Matrix[1, 1]); VDOP = Math.Sqrt(Q_x.Matrix[2, 2]); TDOP = Math.Sqrt(Q_x.Matrix[3, 3]); return sum; }