public GeoCoordinate GetGeodeticCoordinateNow() { var tleISS = ParserTLE.parseTle(TleLine1, TleLine2, TleLine0); var currentTime = new EpochTime(DateTime.UtcNow); // TODO: use sdp4 for satellites with medium/high orbit. var data = SatFunctions.getSatPositionAtTime(tleISS, currentTime, Sgp4.wgsConstant.WGS_84); var secondsFromStart = (currentTime.getEpoch() - Math.Truncate(currentTime.getEpoch())) * 24 * 60 * 60; var omega = OMEGA_E * secondsFromStart; var C = MathNet.Numerics.LinearAlgebra.Double.DenseMatrix.OfArray( new double[, ] { { Math.Cos(omega), Math.Sin(omega), 0 }, { -Math.Sin(omega), Math.Cos(omega), 0 }, { 0, 0, 1 } }); var p = MathNet.Numerics.LinearAlgebra.Double.DenseMatrix.OfArray( new double[, ] { { data.getX() * 1000 }, { data.getY() * 1000 }, { data.getZ() * 1000 } }); var ecr = C * p; GpsUtils.EcefToGeodetic(ecr[0, 0], ecr[1, 0], ecr[2, 0], out var lat, out var lon, out var h); return(new GeoCoordinate(lat, lon, h)); }
public bool IsVisibleFromPointNow(GeoCoordinate observer) { var tleISS = ParserTLE.parseTle(TleLine1, TleLine2, TleLine0); var currentTime = new EpochTime(DateTime.UtcNow); var data = One_Sgp4.SatFunctions.getSatPositionAtTime(tleISS, currentTime, Sgp4.wgsConstant.WGS_84); return(SatFunctions.isSatVisible(new Coordinate(observer.Latitude, observer.Longitude, observer.Altitude), 0, currentTime, data)); }
public void TleParseFromLinesShouldSucceed() { // 0.........1.........2.........3.........4.........5.........6.........7 string line1 = "1 42784U 17036Vvv 17175.91623346 .00001083 00000-0 52625-4 0 9993"; string line2 = "2 42784 97.4499 235.6602 0011188 243.9018 116.1066 15.20524655 207"; Tle t = ParserTLE.parseTle(line1, line2); Assert.That(t.isValidData, Is.True); Assert.That(t.getClassification(), Is.EqualTo(0)); Assert.That(t.getDrag(), Is.EqualTo(0.000052625)); Assert.That(t.getEccentriciy(), Is.EqualTo(0.0011188)); Assert.That(t.getEphemeris(), Is.EqualTo(0)); Assert.That(t.getEpochDay(), Is.EqualTo(175.91623346)); Assert.That(t.getEpochYear(), Is.EqualTo(17)); Assert.That(t.getFirstMeanMotion(), Is.EqualTo(.00001083)); Assert.That(t.getInclination(), Is.EqualTo(97.4499)); Assert.That(t.getMeanAnomoly(), Is.EqualTo(116.1066)); Assert.That(t.getMeanMotion(), Is.EqualTo(15.20524655)); Assert.That(t.getName(), Is.EqualTo("1736Vvv")); Assert.That(t.getNoradID(), Is.EqualTo("42784")); Assert.That(t.getPerigee(), Is.EqualTo(243.9018)); Assert.That(t.getPice(), Is.EqualTo("Vvv")); Assert.That(t.getRelevationNumber(), Is.EqualTo(20)); Assert.That(t.getRightAscendingNode(), Is.EqualTo(235.6602)); Assert.That(t.getSatNumber(), Is.EqualTo(42784)); Assert.That(t.getSecondMeanMotion(), Is.EqualTo(0)); Assert.That(t.getSetNumber(), Is.EqualTo(999)); Assert.That(t.getStartNr(), Is.EqualTo(36)); Assert.That(t.getStartYear(), Is.EqualTo(17)); t = ParserTLE.parseTle(line1, line2, "Pegasus"); Assert.That(t.isValidData, Is.True); Assert.That(t.getClassification(), Is.EqualTo(0)); Assert.That(t.getDrag(), Is.EqualTo(0.000052625)); Assert.That(t.getEccentriciy(), Is.EqualTo(0.0011188)); Assert.That(t.getEphemeris(), Is.EqualTo(0)); Assert.That(t.getEpochDay(), Is.EqualTo(175.91623346)); Assert.That(t.getEpochYear(), Is.EqualTo(17)); Assert.That(t.getFirstMeanMotion(), Is.EqualTo(.00001083)); Assert.That(t.getInclination(), Is.EqualTo(97.4499)); Assert.That(t.getMeanAnomoly(), Is.EqualTo(116.1066)); Assert.That(t.getMeanMotion(), Is.EqualTo(15.20524655)); Assert.That(t.getName(), Is.EqualTo("Pegasus")); Assert.That(t.getNoradID(), Is.EqualTo("42784")); Assert.That(t.getPerigee(), Is.EqualTo(243.9018)); Assert.That(t.getPice(), Is.EqualTo("Vvv")); Assert.That(t.getRelevationNumber(), Is.EqualTo(20)); Assert.That(t.getRightAscendingNode(), Is.EqualTo(235.6602)); Assert.That(t.getSatNumber(), Is.EqualTo(42784)); Assert.That(t.getSecondMeanMotion(), Is.EqualTo(0)); Assert.That(t.getSetNumber(), Is.EqualTo(999)); Assert.That(t.getStartNr(), Is.EqualTo(36)); Assert.That(t.getStartYear(), Is.EqualTo(17)); }
public Satellite(long id, string name, string line1, string line2) { ID = id; Name = name; TleLine1 = line1; TleLine2 = line2; Tle = ParserTLE.parseTle( line1, line2, name); }
public void test2LineFile() { string testpath = TestContext.CurrentContext.TestDirectory + @"\sat42784_1.txt"; var list = ParserTLE.ParseFile(testpath, "Pegasus"); Assert.That(list.Count(), Is.EqualTo(3)); var names = list.Select((t) => t.getName()).Distinct().ToList(); Assert.That(names.Count, Is.EqualTo(1)); Assert.That(names[0], Is.EqualTo("Pegasus")); }
public void test3LineFile() { string testpath = TestContext.CurrentContext.TestDirectory + @"\somesats.txt"; var list = ParserTLE.ParseFile(testpath); Assert.That(list.Count(), Is.EqualTo(3)); var names = list.Select((t) => t.getName()).Distinct().ToList(); Assert.That(names.Count, Is.EqualTo(3)); Assert.That(names, Is.EquivalentTo(new string[] { "Sat123 and Something", "Anotherone", "TheLast" })); }
// Use this for initialization void Start() { var sats = ParserTLE.ParseString("\r\nISS (ZARYA) \r\n1 25544U 98067A 17258.66207433 .00002352 00000-0 42668-4 0 9996\r\n2 25544 51.6434 307.2969 0003696 276.6985 227.2383 15.54196035 75826\r\nTIANGONG 1 \r\n1 37820U 11053A 17259.54739255 .00058138 00000-0 24196-3 0 9994\r\n2 37820 42.7575 358.5910 0019922 5.9603 111.3279 15.84538366342438\r\nAGGIESAT 4 \r\n1 41313U 98067HP 17258.44077356 .00042699 00000-0 23727-3 0 9995\r\n2 41313 51.6381 257.8890 0003807 101.2846 258.8583 15.79044504 93164\r\nNODES 2 \r\n1 41477U 98067HX 17259.43685587 .01745891 31111-2 98571-3 0 9990\r\n2 41477 51.6165 242.2525 0002417 106.9606 253.1612 16.19290091 76600\r\nNODES 1 \r\n1 41478U 98067HY 17259.49295397 .00956277 55723-3 88097-3 0 9992\r\n2 41478 51.6183 243.4798 0003195 83.8364 276.3014 16.11800501 76590\r\nFLOCK 2E'-1 \r\n1 41479U 98067HZ 17259.06212448 .00036116 00000-0 25835-3 0 9999\r\n2 41479 51.6325 271.8323 0001157 14.1796 345.9235 15.73367650 76149\r\nFLOCK 2E'-3 \r\n1 41480U 98067JA 17259.41704939 .00041384 00000-0 30035-3 0 9992\r\n2 41480 51.6319 269.7242 0001960 26.2589 333.8509 15.72961681 76194\r\nFLOCK 2E'-2 \r\n1 41481U 98067JB 17259.44288770 .00042712 00000-0 29463-3 0 9995\r\n2 41481 51.6292 267.5779 0001158 63.8590 296.2528 15.74136671 76215\r\nFLOCK 2E'-4 \r\n1 41482U 98067JC 17259.38931460 .00076989 00000-0 44667-3 0 9996\r\n2 41482 51.6277 264.9284 0002851 67.6433 292.4869 15.77841040 76245\r\nFLOCK 2E-1 \r\n1 41483U 98067JD 17259.50885083 .00030602 00000-0 24000-3 0 9991\r\n2 41483 51.6344 271.1522 0003148 37.6267 322.4951 15.71273051 76047\r\nFLOCK 2E-2 \r\n1 41484U 98067JE 17259.39625517 .00039471 00000-0 27973-3 0 9998\r\n2 41484 51.6357 268.9149 0003418 46.8803 313.2481 15.73538606 76069\r\nFLOCK 2E-3 \r\n1 41486U 98067JG 17259.45362261 .00051238 00000-0 37975-3 0 9999\r\n2 41486 51.6336 273.0184 0003477 56.9950 303.1382 15.72368497 76037\r\nFLOCK 2E-4 \r\n1 41487U 98067JH 17259.43293316 .00030506 00000-0 23819-3 0 9999\r\n2 41487 51.6342 271.3578 0003948 69.1291 291.0130 15.71377561 76059\r\nFLOCK 2E-6 \r\n1 41563U 98067JM 17258.43992194 .00023410 00000-0 20044-3 0 9996\r\n2 41563 51.6342 279.7291 0000366 85.9717 274.1322 15.69317603 73924\r\nFLOCK 2E-5 \r\n1 41564U 98067JN 17259.41065253 .00027179 00000-0 23156-3 0 9996\r\n2 41564 51.6340 274.9725 0000592 48.0856 312.0191 15.69344774 74068\r\nFLOCK 2E-7 \r\n1 41565U 98067JP 17259.45896539 .00041995 00000-0 29451-3 0 9996\r\n2 41565 51.6335 268.4794 0004240 82.7120 277.4360 15.73751132 74056\r\nFLOCK 2E'-5 \r\n1 41567U 98067JR 17259.07438845 .00021444 00000-0 19137-3 0 9995\r\n2 41567 51.6354 278.7541 0004069 100.7144 259.4311 15.68359203 73859\r\nFLOCK 2E'-6 \r\n1 41568U 98067JS 17259.50910311 .00030945 00000-0 24824-3 0 9992\r\n2 41568 51.6336 272.5913 0003732 93.6391 266.5033 15.70722225 74004\r\nFLOCK 2E'-8 \r\n1 41569U 98067JT 17259.41142022 .00045954 00000-0 31736-3 0 9995\r\n2 41569 51.6317 268.1595 0002986 51.4134 308.7132 15.74073710 73930\r\nFLOCK 2E'-7 \r\n1 41570U 98067JU 17259.15190581 .00326900 00000-0 11184-2 0 9998\r\n2 41570 51.6332 263.3951 0006109 65.6729 294.4913 15.88285199 73995\r\nFLOCK 2E-9 \r\n1 41571U 98067JV 17259.10493146 .00049135 00000-0 32274-3 0 9993\r\n2 41571 51.6338 268.3764 0003513 76.6090 283.5301 15.75202360 73881\r\nFLOCK 2E-10 \r\n1 41572U 98067JW 17259.43790460 .00040058 00000-0 29117-3 0 9996\r\n2 41572 51.6332 269.8731 0004295 86.0198 274.1292 15.72933573 73898\r\nFLOCK 2E-12 \r\n1 41573U 98067JX 17259.44634512 .00045252 00000-0 30943-3 0 9993\r\n2 41573 51.6318 268.4001 0003562 89.2684 270.8723 15.74308568 73916\r\nFLOCK 2E-11 \r\n1 41574U 98067JY 17259.43303495 .00045358 00000-0 30983-3 0 9997\r\n2 41574 51.6309 267.5048 0004012 97.0920 263.0536 15.74330073 73922\r\nFLOCK 2E'-9 \r\n1 41575U 98067JZ 17259.42109348 .00051747 00000-0 32968-3 0 9992\r\n2 41575 51.6310 265.8894 0003384 102.4574 257.6804 15.75881081 73931\r\nFLOCK 2E'-10 \r\n1 41576U 98067KA 17259.04663571 .00042982 00000-0 28831-3 0 9999\r\n2 41576 51.6339 270.2669 0003738 104.6053 255.5361 15.74776751 73742\r\nFLOCK 2E'-11 \r\n1 41577U 98067KB 17259.43910863 .00042291 00000-0 30015-3 0 9992\r\n2 41577 51.6337 269.1541 0004120 90.8730 269.2741 15.73469385 73612\r\nFLOCK 2E'-12 \r\n1 41578U 98067KC 17259.40893504 .00050874 00000-0 32560-3 0 9995\r\n2 41578 51.6308 267.3432 0004939 80.8682 279.2876 15.75775858 73632\r\nFLOCK 2E'-13 \r\n1 41761U 98067KH 17259.09030231 .00016650 00000-0 18762-3 0 9996\r\n2 41761 51.6371 292.4464 0005059 248.1918 111.8538 15.62666949 57112\r\nFLOCK 2E'-14 \r\n1 41762U 98067KJ 17259.44658629 .00019477 00000-0 21522-3 0 9991\r\n2 41762 51.6383 290.3594 0004825 252.0732 107.9737 15.63046543 57171\r\nFLOCK 2E'-16 \r\n1 41763U 98067KK 17259.45272653 .00021392 00000-0 23075-3 0 9996\r\n2 41763 51.6387 289.6477 0004402 268.1222 91.9268 15.63598994 57140\r\nFLOCK 2E'-15 \r\n1 41764U 98067KL 17259.49110669 .00016312 00000-0 18459-3 0 9995\r\n2 41764 51.6382 290.6515 0004814 259.2917 100.7535 15.62576791 57135\r\nTIANGONG-2 \r\n1 41765U 16057A 17259.19774463 .00001950 00000-0 29267-4 0 9992\r\n2 41765 42.7843 174.3143 0002085 188.1494 334.0354 15.58804008 57188\r\nFLOCK 2E'-18 \r\n1 41769U 98067KM 17259.15433421 .00017075 00000-0 19269-3 0 9994\r\n2 41769 51.6381 292.1460 0004198 287.2844 72.7691 15.62611238 57081\r\nFLOCK 2E'-17 \r\n1 41776U 98067KN 17259.46199287 .00018562 00000-0 20783-3 0 9990\r\n2 41776 51.6391 290.4765 0004585 289.0414 71.0083 15.62744945 57126\r\nFLOCK 2E'-19 \r\n1 41777U 98067KP 17259.15914849 .00031129 00000-0 30210-3 0 9996\r\n2 41777 51.6365 287.6394 0003455 295.9144 64.1496 15.66048367 57091\r\nFLOCK 2E'-20 \r\n1 41782U 98067KQ 17259.52525685 .00020402 00000-0 20762-3 0 9992\r\n2 41782 51.6376 287.1235 0003486 294.4833 65.5799 15.65119517 57008\r\nBANXING-2 \r\n1 41834U 16057H 17258.81249130 .00016251 00000-0 13492-3 0 9997\r\n2 41834 42.7820 163.4597 0007059 175.3284 251.9219 15.69886081 51345\r\nSTARS-C \r\n1 41895U 98067KR 17259.14493371 .00052131 00000-0 47582-3 0 9994\r\n2 41895 51.6363 293.5585 0004399 338.6484 21.4328 15.67326335 42222\r\nTANCREDO-1 \r\n1 41931U 98067KT 17259.09152068 .00213113 00000-0 97356-3 0 9997\r\n2 41931 51.6301 284.8534 0004539 2.9311 357.1718 15.82593573 37906\r\nITF-2 \r\n1 41932U 98067KU 17259.47249932 .00027256 00000-0 31060-3 0 9998\r\n2 41932 51.6400 295.7996 0003670 265.3256 94.7319 15.62032672 37792\r\nWASEDA-SAT3 \r\n1 41933U 98067KV 17259.15088613 .00027914 00000-0 30592-3 0 9991\r\n2 41933 51.6381 296.6211 0003516 270.1141 89.9451 15.63026120 37758\r\nAOBA-VELOX 3 \r\n1 41935U 98067KX 17259.30940959 .00032111 00000-0 35586-3 0 9993\r\n2 41935 51.6395 296.2020 0003199 273.7883 86.2745 15.62663435 37872\r\nOSNSAT \r\n1 41939U 98067KZ 17259.12189876 .00067811 00000-0 54141-3 0 9993\r\n2 41939 51.6352 291.1399 0003401 301.8086 58.2580 15.70481073 37170\r\nLEMUR-2-REDFERN-GOES \r\n1 42059U 98067LA 17259.46699910 .00028201 00000-0 33476-3 0 9997\r\n2 42059 51.6383 297.9859 0006671 290.4189 69.6088 15.60934475 30251\r\nLEMUR-2-TRUTNA \r\n1 42067U 98067LC 17259.19357411 .00048382 00000-0 47099-3 0 9991\r\n2 42067 51.6377 296.9002 0005487 302.2625 57.7838 15.65749823 30070\r\nLEMUR-2-AUSTINTACIOUS \r\n1 42068U 98067LD 17259.49151412 .00034259 00000-0 38658-3 0 9997\r\n2 42068 51.6386 297.3993 0006194 291.2578 68.7755 15.62150016 30195\r\nLEMUR-2-TRUTNAHD \r\n1 42069U 98067LE 17259.51233356 .00025476 00000-0 29771-3 0 9996\r\n2 42069 51.6394 297.5521 0005883 291.6169 68.4198 15.61408730 30240\r\nISS DEB \r\n1 42434U 98067LF 17259.46956901 .00227412 00000-0 13365-2 0 9999\r\n2 42434 51.6309 291.9363 0004754 3.7821 356.3214 15.77018387 26488\r\nTIANZHOU 1 \r\n1 42684U 17021A 17258.52795139 .00003636 00000-0 50476-4 0 9993\r\n2 42684 42.7842 178.2941 0001650 185.6588 173.2777 15.58806357 57079\r\nISS DEB \r\n1 42697U 98067LG 17259.14043462 .00188209 00000-0 14041-2 0 9996\r\n2 42697 51.6331 298.7694 0006241 353.5693 6.5224 15.71605930 20885\r\nHAVELSAT \r\n1 42700U 98067LH 17259.41627837 .00024834 00000-0 32482-3 0 9998\r\n2 42700 51.6395 301.3980 0006277 318.2733 41.7780 15.58453362 19152\r\nSOMP 2 \r\n1 42701U 98067LJ 17259.49209313 .00020141 00000-0 26796-3 0 9990\r\n2 42701 51.6394 301.1584 0006165 318.6081 41.4443 15.58139697 19151\r\nCOLUMBIA \r\n1 42702U 98067LK 17259.37623948 .00062670 00000-0 70270-3 0 9991\r\n2 42702 51.6386 300.3788 0006488 325.9005 34.1571 15.62040602 19080\r\nSGSAT \r\n1 42703U 98067LL 17259.22710250 .00048423 00000-0 57533-3 0 9996\r\n2 42703 51.6380 301.6300 0001868 318.1448 41.9402 15.60666337 19043\r\nCXBN-2 \r\n1 42704U 98067LM 17259.17872088 .00025021 00000-0 33128-3 0 9992\r\n2 42704 51.6399 302.8134 0001296 295.2251 64.8607 15.58140052 19032\r\nICECUBE \r\n1 42705U 98067LN 17259.41677008 .00033973 00000-0 43289-3 0 9999\r\n2 42705 51.6406 301.4123 0001155 293.6815 66.4057 15.58991246 19134\r\nPHOENIX \r\n1 42706U 98067LP 17259.16649725 .00024047 00000-0 31692-3 0 9994\r\n2 42706 51.6395 302.7348 0001522 330.7490 29.3417 15.58286796 19028\r\nX-CUBESAT \r\n1 42707U 98067LQ 17259.35878552 .00026496 00000-0 34754-3 0 9990\r\n2 42707 51.6386 301.7647 0001666 334.8956 25.1956 15.58355264 19042\r\nQBEE50-LTU-OC \r\n1 42708U 98067LR 17259.49036095 .00024961 00000-0 32874-3 0 9990\r\n2 42708 51.6387 301.1440 0001674 333.9112 26.1796 15.58282225 19029\r\nALTAIR PATHFINDER \r\n1 42711U 98067LS 17259.41972892 .00016506 00000-0 23066-3 0 9999\r\n2 42711 51.6397 302.1684 0003312 247.0824 112.9818 15.56983828 18710\r\nSHARC \r\n1 42712U 98067LT 17259.42037427 .00011592 00000-0 16514-3 0 9997\r\n2 42712 51.6403 302.1788 0001446 257.8173 102.2657 15.56813986 18952\r\nZA-AEROSAT \r\n1 42713U 98067LU 17259.45357709 .00020564 00000-0 27898-3 0 9995\r\n2 42713 51.6396 301.6485 0001186 258.8452 101.2406 15.57615670 18721\r\nLINK \r\n1 42714U 98067LV 17259.36689045 .00033552 00000-0 43193-3 0 9994\r\n2 42714 51.6390 301.8149 0001237 294.9290 65.1574 15.58724945 18825\r\nCSUNSAT 1 \r\n1 42715U 98067LW 17259.39537897 .00024281 00000-0 32720-3 0 9998\r\n2 42715 51.6395 302.0062 0003097 238.5585 121.5105 15.57683701 18713\r\nUPSAT \r\n1 42716U 98067LX 17258.38995576 .00026403 00000-0 34208-3 0 9990\r\n2 42716 51.6397 306.5451 0004826 322.0418 38.0234 15.58676454 18692\r\nSPACECUBE \r\n1 42717U 98067LY 17259.37222561 .00026264 00000-0 34736-3 0 9999\r\n2 42717 51.6395 301.8547 0004719 324.3730 35.6947 15.58131588 18089\r\nHOOPOE \r\n1 42718U 98067LZ 17259.49016339 .00026446 00000-0 34547-3 0 9999\r\n2 42718 51.6391 301.1443 0004740 325.2876 34.7807 15.58456701 18104\r\nCHALLENGER \r\n1 42721U 98067MA 17259.48804548 .00033088 00000-0 41903-3 0 9993\r\n2 42721 51.6384 301.1228 0007010 301.8179 58.2131 15.59143886 17805\r\nNJUST-1 \r\n1 42722U 98067MB 17259.47687756 .00020836 00000-0 28506-3 0 9994\r\n2 42722 51.6394 301.8008 0007004 297.0393 62.9883 15.57359143 17794\r\nUNSW-ECO \r\n1 42723U 98067MC 17259.38948863 .00030009 00000-0 39459-3 0 9996\r\n2 42723 51.6398 301.9707 0006866 299.0031 61.0273 15.58197404 17763\r\nDUTHSAT \r\n1 42724U 98067MD 17259.49815121 .00035472 00000-0 45198-3 0 9995\r\n2 42724 51.6397 301.1938 0006266 306.8742 53.1676 15.58951915 17709\r\nLILACSAT-1 \r\n1 42725U 98067ME 17259.34875902 .00025468 00000-0 34446-3 0 9991\r\n2 42725 51.6395 302.4481 0006103 302.5571 57.4831 15.57542575 17671\r\nNSIGHT-1 \r\n1 42726U 98067MF 17259.38096860 .00012948 00000-0 18639-3 0 9999\r\n2 42726 51.6404 302.6638 0006133 300.1057 59.9327 15.56397128 17684\r\nSNUSAT-1 \r\n1 42727U 98067MG 17259.47493448 .00024118 00000-0 32586-3 0 9992\r\n2 42727 51.6385 301.7829 0006559 259.2313 100.7941 15.57600256 17661\r\nQBITO \r\n1 42728U 98067MH 17259.33138590 .00027723 00000-0 36880-3 0 9998\r\n2 42728 51.6405 302.3362 0003784 319.1870 40.8838 15.57947731 17486\r\nAALTO-2 \r\n1 42729U 98067MJ 17259.39536704 .00027499 00000-0 36592-3 0 9994\r\n2 42729 51.6397 302.0098 0003786 319.7157 40.3554 15.57945079 17502\r\nSUSAT \r\n1 42730U 98067MK 17259.33635476 .00025528 00000-0 34234-3 0 9998\r\n2 42730 51.6395 302.3641 0003771 316.6379 43.4316 15.57780521 17481\r\nI-INSPIRE II \r\n1 42731U 98067ML 17259.38508736 .00031598 00000-0 41217-3 0 9995\r\n2 42731 51.6384 301.9313 0005548 245.5702 114.4712 15.58392180 17542\r\nPOLYITAN-2-SAU \r\n1 42732U 98067MM 17259.13567635 .00024089 00000-0 32051-3 0 9995\r\n2 42732 51.6389 303.2648 0005856 242.1051 117.9348 15.58017456 17505\r\nSNUSAT-1B \r\n1 42733U 98067MN 17259.40089780 .00025531 00000-0 34167-3 0 9999\r\n2 42733 51.6389 302.0380 0005756 245.1571 114.8823 15.57827052 17543\r\nEXALTA-1 \r\n1 42734U 98067MP 17259.51389149 .00025744 00000-0 33799-3 0 9990\r\n2 42734 51.6386 301.2940 0007665 272.2930 87.7185 15.58320609 17518\r\nAOXIANG-1 \r\n1 42735U 98067MQ 17259.47394435 .00021264 00000-0 28992-3 0 9992\r\n2 42735 51.6392 301.7801 0007560 293.0405 66.9789 15.57433101 18925\r\nBEEAGLESAT \r\n1 42736U 98067MR 17259.53505380 .00021332 00000-0 28905-3 0 9993\r\n2 42736 51.6391 301.4396 0007464 293.5191 66.5016 15.57598427 17629\r\nATLANTIS \r\n1 42737U 98067MS 17258.54712554 .00051386 00000-0 60636-3 0 9996\r\n2 42737 51.6377 305.3338 0007188 298.6894 61.3377 15.60793860 17379\r\nPROGRESS-MS 06 \r\n1 42756U 17033A 17258.52642144 .00002378 00000-0 43064-4 0 9990\r\n2 42756 51.6436 307.9738 0003676 275.6412 188.8006 15.54195380 14497\r\nISS DEB (ROSA) \r\n1 42813U 98067MT 17258.59735590 .00053313 00000-0 66394-3 0 9990\r\n2 42813 51.6389 306.4234 0003623 299.4705 60.5926 15.59385582 12769\r\nSOYUZ-MS 05 \r\n1 42898U 17043A 17258.52642144 .00002378 00000-0 43064-4 0 9998\r\n2 42898 51.6436 307.9738 0003676 275.6412 188.8006 15.54195380 7609\r\nDRAGON CRS-12 \r\n1 42904U 17045A 17258.52642144 .00002378 00000-0 43064-4 0 9998\r\n2 42904 51.6436 307.9738 0003676 275.6412 188.8006 15.54195380 4952\r\nSOYUZ-MS 06 \r\n1 42937U 17054A 17258.52642144 .00002378 00000-0 43064-4 0 9994\r\n2 42937 51.6436 307.9738 0003676 275.6412 188.8006 15.54195380 75800") //.Take(10) .Select(s => this.InstantiateSatalite(s)) .ToList(); this.DrawnSatalites.AddRange(sats); this.Calculator = new CoordinateCalculator(51.9839248, 5.9107478, 20, DateTime.UtcNow.AddDays(0.6)); }
public void TleParseFromLinesWithChecksumErrorShouldFail(string line1, string line2) { try { Tle t = ParserTLE.parseTle(line1, line2); Assert.Fail("This should raise an exception!"); } catch (Exception ex) { Assert.That(ex, Is.TypeOf <InvalidDataException>()); Assert.That(ex.Message, Contains.Substring("checksum error")); } }
public void TestSatContact() { Tle tleISS = ParserTLE.parseTle( "1 25544U 98067A 19356.46068278 .00000035 00000-0 86431-5 0 9990", "2 25544 51.6420 147.9381 0007793 61.6458 55.7201 15.50124783204461", "ISS 1"); Coordinate position = new Coordinate(35, 18, 0); EpochTime startTime = new EpochTime(0, 0, 0, 2020, 1, 6); List <Pass> passes = SatFunctions.CalculatePasses(position, tleISS, startTime, 1, 1); Assert.AreEqual(8, passes.Count); }
public void TleParseFromCorruptLinesShouldFail() { string line1 = "1 42784U 17036V 17175.91623346 .00001083 00000 - 0 52625 - 4 0 9993"; string line2 = "2 42784 97.4499 235.6602 0011188 243.9018 116.1066 15.20524655 207"; try { Tle t = ParserTLE.parseTle(line1, line2); Assert.Fail("This should raise an exception!"); } catch (Exception ex) { Assert.That(ex, Is.TypeOf <InvalidDataException>()); Assert.That(ex.Message, Contains.Substring("parse error")); } }
/***************************************************************************** * @function name : calECIDateAndVelocity * @author : Kaguya * @date : 2020/12/3 12:38 * @inparam : * @outparam : * @last change : * @usage : 基于one_sgp4项目,计算航天器基于ECI坐标系下的位置和速度 *****************************************************************************/ public void calECIDateAndVelocity() { Tle tleISS = ParserTLE.parseTle(first, second, "ISS 1"); DateTime t = new DateTime(data[0], data[1], data[2], data[3], data[4], data[5]); EpochTime startTime = new EpochTime(t); Sgp4Data sate = SatFunctions.getSatPositionAtTime(tleISS, startTime, Sgp4.wgsConstant.WGS_84); One_Sgp4.Point3d position = sate.getPositionData(); ECI = new double[3]; ECI[0] = position.x; ECI[1] = position.y; ECI[2] = position.z; velocity = new double[3]; velocity[0] = sate.getVelocityData().x; velocity[1] = sate.getVelocityData().y; velocity[2] = sate.getVelocityData().z; velocity = getECEF(velocity, data); }
public void TestSatGroundPosition(int hh, int mm, int ss, int yyyy, int MM, int dd) { Tle tleISS = ParserTLE.parseTle( "1 25544U 98067A 19356.46068278 .00000035 00000-0 86431-5 0 9990", "2 25544 51.6420 147.9381 0007793 61.6458 55.7201 15.50124783204461", "ISS 1"); EpochTime testTime = new EpochTime(hh, mm, ss, yyyy, MM, dd); Sgp4Data data = SatFunctions.getSatPositionAtTime(tleISS, testTime, Sgp4.wgsConstant.WGS_84); Assert.IsNotNull(data); Coordinate ground = SatFunctions.calcSatSubPoint(testTime, data, Sgp4.wgsConstant.WGS_84); Assert.Greater(ground.getHeight(), 0); Assert.LessOrEqual(ground.getLongitude(), 180.0); Assert.Greater(ground.getLongitude(), -180.0); Assert.LessOrEqual(ground.getLatitude(), 90.0); Assert.Greater(ground.getLatitude(), -90.0); }
static void Main(string[] args) { //Parse three line element Tle tleISS = ParserTLE.parseTle( "1 25544U 98067A 19132.30925117 .00001081 00000-0 24694-4 0 9993", "2 25544 51.6426 179.4820 0001363 344.4861 92.2261 15.52657683169680", "ISS 1"); //Parse tle from file if (System.IO.File.Exists("tleData.txt")) { List <Tle> tleList = ParserTLE.ParseFile("tleData.txt"); } //Get TLE from Space-Track.org //list of satellites by their NORAD ID string[] noradIDs = { "8709", "43572" }; try { One_Sgp4.SpaceTrack.GetSpaceTrack(noradIDs, "USERNAME", "PASSWORD"); } catch { Console.Out.WriteLine("Error could not retrive TLE's from Space-Track, Login credentials might be wrong"); } //Create Time points EpochTime startTime = new EpochTime(DateTime.UtcNow); EpochTime anotherTime = new EpochTime(2018, 100.5); //(Year 2018, 100 day at 12:00 HH) EpochTime stopTime = new EpochTime(DateTime.UtcNow.AddHours(1)); //get time difference double daysSince = startTime - anotherTime; //throws exception if first time > second time //double daysSince = anotherTime - startTime; //compare Time points EpochTime compareTime = new EpochTime(2018, 100.5); //(Year 2018, 100 day at 12:00 HH) bool equals = anotherTime == compareTime; bool notequals = startTime != anotherTime; bool greater = startTime > anotherTime; bool smaler = anotherTime < startTime; //Add 15 Seconds to EpochTime anotherTime.addTick(15); //Add 20 Min to EpochTime anotherTime.addMinutes(15); //Add 1 hour to EpochTime anotherTime.addHours(1); //Add 2 Days to EpochTime anotherTime.addDays(2); Console.Out.WriteLine(anotherTime.ToString()); //Calculate Satellite Position and Speed One_Sgp4.Sgp4 sgp4Propagator = new Sgp4(tleISS, Sgp4.wgsConstant.WGS_84); //set calculation parameters StartTime, EndTime and caclulation steps in minutes sgp4Propagator.runSgp4Cal(startTime, stopTime, 1 / 30.0); // 1/60 => caclulate sat points every 2 seconds List <One_Sgp4.Sgp4Data> resultDataList = new List <Sgp4Data>(); //Return Results containing satellite Position x,y,z (ECI-Coordinates in Km) and Velocity x_d, y_d, z_d (ECI-Coordinates km/s) resultDataList = sgp4Propagator.getRestults(); //Coordinate of an observer on Ground lat, long, height(in meters) One_Sgp4.Coordinate observer = new Coordinate(35.00, 18.0, 0); //Convert to ECI coordinate system One_Sgp4.Point3d eci = observer.toECI(startTime.getLocalSiderealTime()); //Get Local SiderealTime for Observer double localSiderealTime = startTime.getLocalSiderealTime(observer.getLongitude()); //Calculate if Satellite is Visible for a certain Observer on ground at certain timePoint bool satelliteIsVisible = One_Sgp4.SatFunctions.isSatVisible(observer, 0.0, startTime, resultDataList[0]); //Calculate Sperical Coordinates from an Observer to Satellite //returns 3D-Point with range(km), azimuth(radians), elevation(radians) to the Satellite One_Sgp4.Point3d spherical = One_Sgp4.SatFunctions.calcSphericalCoordinate(observer, startTime, resultDataList[0]); //Calculate the Next 5 Passes over a point //for a location, Satellite, StartTime, Accuracy in Seconds = 15sec, MaxNumber of Days = 5 Days, Wgs constant = WGS_84 //Returns pass with Location, StartTime of Pass, EndTime Of Pass, Max Elevation in Degrees List <Pass> passes = One_Sgp4.SatFunctions.CalculatePasses(observer, tleISS, new EpochTime(DateTime.UtcNow), 15, 5, Sgp4.wgsConstant.WGS_84); foreach (var p in passes) { Console.Out.WriteLine(p.ToString()); } Console.Out.WriteLine("Done"); }
public static async Task <Satellite> FindClosestSatellite(double userLat, double userLong, double userHeight) { List <Tle> tleList = ParserTLE.ParseFile(pathToTLEData); Vector3 difference = new Vector3(0, 0, 0); Satellite closest = new Satellite("Temporary Satellite. If you see this, you done messed up", double.MaxValue); List <Satellite> satellites = new List <Satellite>(); One_Sgp4.Coordinate observer = new Coordinate(userLat, userLong, userHeight); for (int i = 0; i < tleList.Count; i++) { //Create Time points EpochTime startTime = new EpochTime(DateTime.UtcNow); EpochTime stopTime = new EpochTime(DateTime.UtcNow.AddHours(1)); One_Sgp4.Sgp4 sgp4Propagator = new Sgp4(tleList[i], Sgp4.wgsConstant.WGS_84); try { sgp4Propagator.runSgp4Cal(startTime, stopTime, 0.5); } catch { Console.WriteLine("Something went wrong with " + tleList[i].getName()); } List <One_Sgp4.Sgp4Data> resultDataList = new List <Sgp4Data>(); //Return Results containing satellite Position x,y,z (ECI-Coordinates in Km) and Velocity x_d, y_d, z_d (ECI-Coordinates km/s) resultDataList = sgp4Propagator.getResults(); try { double localSiderealTime = startTime.getLocalSiderealTime(observer.getLongitude()); Sgp4Data grrPoint = One_Sgp4.SatFunctions.getSatPositionAtTime(tleList[0], startTime, Sgp4.wgsConstant.WGS_84); One_Sgp4.Point3d sphCoordsSat = One_Sgp4.SatFunctions.calcSphericalCoordinate(observer, startTime, resultDataList[0]); double distance = sphCoordsSat.x; Satellite satellite = new Satellite(tleList[i].getName(), distance); satellites.Add(satellite); if (distance < closest.distance) { closest = satellite; } } catch { //Something went wrong with a satellite, skipped } } closest.distance = Math.Round(closest.distance, 2); return(closest); //Console.WriteLine("Done: " + satellites.Count + " satellites successfully analyzed from " + tleList.Count + " in the dataset."); //Console.WriteLine("The closest active satellite is " + closest.name.Trim() + " which is " + Math.Round(closest.distance, 2).ToString() + " kilometres away from you. Time: " + DateTime.Now.ToString("HH:mm:ss")); //Console.WriteLine(); }
static void Main(string[] args) { //Parse three line element Tle tleISS = ParserTLE.parseTle( "1 25544U 98067A 19097.23063721 -.00000469 00000-0 00000+0 0 9999", "2 25544 51.6449 353.9503 0002279 151.1697 290.4275 15.52495932164239", "ISS 1"); //Parse tle from file if (System.IO.File.Exists("tleData.txt")) { List <Tle> tleList = ParserTLE.ParseFile("tleData.txt"); } //Get TLE from Space-Track.org //list of satellites by their NORAD ID string[] noradIDs = { "8709", "43572" }; try { One_Sgp4.SpaceTrack.GetSpaceTrack(noradIDs, "USERNAME", "PASSWORD"); } catch { Console.Out.WriteLine("Error could not retrive TLE's from Space-Track, Login credentials might be wrong"); } //Create Time points EpochTime startTime = new EpochTime(DateTime.UtcNow); EpochTime anotherTime = new EpochTime(2018, 100.5); //(Year 2017, 100 day at 12:00 HH) EpochTime stopTime = new EpochTime(DateTime.UtcNow.AddHours(1)); //Add 15 Seconds to EpochTime anotherTime.addTick(15); //Add 20 Min to EpochTime anotherTime.addMinutes(15); //Add 1 hour to EpochTime anotherTime.addHours(1); //Add 2 Days to EpochTime anotherTime.addDays(2); Console.Out.WriteLine(anotherTime.ToString()); //Calculate Satellite Position and Speed One_Sgp4.Sgp4 sgp4Propagator = new Sgp4(tleISS, Sgp4.wgsConstant.WGS_84); //set calculation parameters StartTime, EndTime and caclulation steps in minutes sgp4Propagator.runSgp4Cal(startTime, stopTime, 1 / 30.0); // 1/60 => caclulate sat points every 2 seconds List <One_Sgp4.Sgp4Data> resultDataList = new List <Sgp4Data>(); //Return Results containing satellite Position x,y,z (ECI-Coordinates in Km) and Velocity x_d, y_d, z_d (ECI-Coordinates km/s) resultDataList = sgp4Propagator.getRestults(); //Coordinate of an observer on Ground lat, long, height(in meters) One_Sgp4.Coordinate observer = new Coordinate(35.554595, 18.888574, 0); //Convert to ECI coordinate system One_Sgp4.Point3d eci = observer.toECI(startTime.getLocalSiderealTime()); //Get Local SiderealTime for Observer double localSiderealTime = startTime.getLocalSiderealTime(observer.getLongitude()); //TESTING MIR //TEST ECI EpochTime T_eciTime = new EpochTime(09, 00, 00, 1995, 10, 1); //Test GMST if (T_eciTime.getLocalSiderealTime() == 2.524218) { } Coordinate T_eciCoo = new Coordinate(40, -75); var t_eci = T_eciCoo.toECI(T_eciTime.getLocalSiderealTime()); //Coordinate equals x' = 1703.295 km, y' = 4586.650 km, z' = 4077.984 km. EpochTime t_time = new EpochTime(12, 46, 0, 1995, 11, 18); Coordinate t_cord = new Coordinate(45.0, -93); Sgp4Data mirPos = new Sgp4Data(); mirPos.setX(-4400.594); mirPos.setY(1932.870); mirPos.setZ(4760.712); var lookAngels = SatFunctions.calcSphericalCoordinate(t_cord, t_time, mirPos); var onGround = SatFunctions.calcSatSubPoint(t_time, mirPos, Sgp4.wgsConstant.WGS_72); var r = t_cord.toECI(t_time.getLocalSiderealTime()); //Calculate if Satellite is Visible for a certain Observer on ground at certain timePoint bool satelliteIsVisible = One_Sgp4.SatFunctions.isSatVisible(observer, 0.0, startTime, resultDataList[0]); //Calculate Sperical Coordinates from an Observer to Satellite //returns 3D-Point with range(km), azimuth(radians), elevation(radians) to the Satellite One_Sgp4.Point3d spherical = One_Sgp4.SatFunctions.calcSphericalCoordinate(observer, startTime, resultDataList[0]); //Calculate the Next 5 Passes over a point //for a location, Satellite, StartTime, Accuracy in Seconds = 15sec, MaxNumber of Days = 5 Days, Wgs constant = WGS_84 //Returns pass with Location, StartTime of Pass, EndTime Of Pass, Max Elevation in Degrees List <Pass> passes = One_Sgp4.SatFunctions.CalculatePasses(observer, tleISS, new EpochTime(DateTime.UtcNow), 15, 5, Sgp4.wgsConstant.WGS_84); foreach (var p in passes) { Console.Out.WriteLine(p.ToString()); } }