Tle.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Ips.Library.Entity
  5. {
  6. public class Tle
  7. {
  8. public class Enum
  9. {
  10. public enum SatClass
  11. {
  12. UNCLASSIFIED = 0, //!< int 0 unclassified satellite
  13. CLASSIFIED = 1, //!< int 1 classified satellite
  14. SECRET = 2 //!< int 2 secret satellite
  15. };
  16. }
  17. public string TleName { get; set; }
  18. public string Line1 { get; set; }
  19. public string Line2 { get; set; }
  20. public string TleText
  21. {
  22. get
  23. {
  24. return $"{TleName};{Line1};{Line2}";
  25. }
  26. }
  27. private string satName; /*!<Object Name Identifier*/
  28. private int epochYear; /*!< Epoch 2 digits StartYear (08)*/
  29. private double epochDay; /*!< Epoch fractional portion of the Day (264.51782528)*/
  30. private int satNumber; /*!< Satellite Number (25544) */
  31. public Tle()
  32. {
  33. }
  34. public Tle(string satName, int satNumber, int year, double day)
  35. {
  36. this.satName = satName;
  37. this.satNumber = satNumber;
  38. this.epochYear = year;
  39. this.epochDay = day;
  40. }
  41. public bool isValidData()
  42. {
  43. return true;
  44. }
  45. public string getName()
  46. {
  47. return satName;
  48. }
  49. public int getSatNumber()
  50. {
  51. return satNumber;
  52. }
  53. public DateTime getEpochTime()
  54. {
  55. int year = 0;
  56. if (epochYear < 57)
  57. year = epochYear + 2000;
  58. else
  59. year = epochYear + 1900;
  60. var epoch = new DateTime(year, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddDays(epochDay - 1);
  61. return epoch.ToLocalTime();
  62. }
  63. }
  64. }