tm_get_adcs_tle.lua 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. function tm_get_adcs_tle(buffer, pinfo, tree, adcs_tle, offset)
  2. local f_inclination = ProtoField.double("adcs_tle.inclination", "Inclination (Degrees)")
  3. local f_eccentricity = ProtoField.double("adcs_tle.eccentricity", "Eccentricity")
  4. local f_raan = ProtoField.double("adcs_tle.raan", "Right-Ascension of the Ascending Node (Degrees)")
  5. local f_arg_perigee = ProtoField.double("adcs_tle.arg_perigee", "Argument of Perigee (Degrees)")
  6. local f_b_star = ProtoField.double("adcs_tle.b_star", "B-Star Drag Term")
  7. local f_mean_motion = ProtoField.double("adcs_tle.mean_motion", "Mean Motion (Revolutions per day)")
  8. local f_mean_anomaly = ProtoField.double("adcs_tle.mean_anomaly", "Mean Anomaly (Degrees)")
  9. local f_epoch_time = ProtoField.double("adcs_tle.epoch_time", "Epoch Time (Julian Date)")
  10. -- Register fields with the protocol
  11. adcs_tle.fields = {
  12. f_inclination,
  13. f_eccentricity,
  14. f_raan,
  15. f_arg_perigee,
  16. f_b_star,
  17. f_mean_motion,
  18. f_mean_anomaly,
  19. f_epoch_time
  20. }
  21. local subtree = tree:add(adcs_tle, buffer(), "TM GET ADCS TLE")
  22. offset = offset + 3
  23. local data = buffer(offset,1):le_int()
  24. offset = offset + 1
  25. if data == 0 then
  26. local data = buffer(offset,8):le_float()
  27. subtree:add(f_inclination, data):set_text(string.format("Inclination : %0.6f",data))
  28. offset = offset + 8
  29. data = buffer(offset,8):le_float()
  30. subtree:add(f_eccentricity, data):set_text(string.format("Eccentricity : %0.6f",data))
  31. offset = offset + 8
  32. data = buffer(offset,8):le_float()
  33. subtree:add(f_raan, data):set_text(string.format("Raan : %0.6f",data))
  34. offset = offset + 8
  35. data = buffer(offset,8):le_float()
  36. subtree:add(f_arg_perigee, data):set_text(string.format("Arg perigee : %0.6f",data))
  37. offset = offset + 8
  38. data = buffer(offset,8):le_float()
  39. subtree:add(f_b_star, data):set_text(string.format("B star : %0.6f",data))
  40. offset = offset + 8
  41. data = buffer(offset,8):le_float()
  42. subtree:add(f_mean_motion, data):set_text(string.format("Mean motion : %0.6f",data))
  43. offset = offset + 8
  44. data = buffer(offset,8):le_float()
  45. subtree:add(f_mean_anomaly, data):set_text(string.format("Mean anomaly : %0.6f",data))
  46. offset = offset + 8
  47. data = buffer(offset,8):le_float()
  48. subtree:add(f_epoch_time, data):set_text(string.format("Epoch time : %0.6f",data))
  49. offset = offset + 8
  50. elseif data == -1 then
  51. subtree:add(" ADCS operation failure ")
  52. elseif data == -2 then
  53. subtree:add(" TC TM error ")
  54. elseif data == -3 then
  55. subtree:add(" Interface error ")
  56. elseif data == -4 then
  57. subtree:add(" Id not support ")
  58. elseif data == -5 then
  59. subtree:add(" ADCS HW in invalid power state ")
  60. elseif data == -6 then
  61. subtree:add(" ADCS Semaphore take failure ")
  62. elseif data == -6 then
  63. subtree:add(" ADCS Operating Mode Mismatch error ")
  64. elseif data == -6 then
  65. subtree:add(" ADCS responded data is not in a valid range ")
  66. end
  67. end