Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. // ----------------------------------------------------------------------------
  2. // setInclination(id)
  3. // Attempts to adjust the inclination of the current orbit to the desired angle
  4. // Always performs burn at apoapsis for most efficient burn. It may be wise to
  5. // break the full adjustment into smaller bits, or consider raising apoapsis
  6. // to save fuel.
  7. // ----------------------------------------------------------------------------
  8. function setInclination {
  9. declare parameter id. // inclination desired
  10.  
  11. // nodeEta needs to not be using apoapsis for change point, this needs to be at an or dn.
  12. // which I cannot compute at this time.
  13.  
  14. // gather infos
  15. local nodeEta to eta:apoapsis. // ETA to burn node
  16. local ApTime to nodeEta + time:seconds. // Apoapsis time
  17. local o to orbitat(ship, ApTime). // ship orbit
  18. local ii to o:inclination. // initial inclination
  19. local e to o:eccentricity. // eccentricity
  20. local w to o:argumentofperiapsis. // argument of periapsis
  21. local f to o:trueanomaly. // true anomoly at ETA
  22. local oP to o:period. // orbit period
  23. local n to calcMeanMotion(oP). // mean motion calclation
  24. local a to o:semimajoraxis. // semi major axis.
  25. local di to ii - id. // difference in inclination
  26. if di < -180 {
  27. set di to di + 360.
  28. }
  29.  
  30. print "T+" + round(missiontime) + " di: " + di.
  31.  
  32. local top to 2 * sin(di/2) * sqrt(1 - e*e) * cos(w + f) * n * a.
  33. local bottom to 1 + e * cos(f).
  34. local dV to top / bottom.
  35.  
  36. print "T+" + round(missiontime) + " Result dV: " + dV.
  37. // TODO: Burn Direction is not worked out yet, I shoulld be burning normal
  38. // at the ascending node and anti-normal at decending to raise the inclination.
  39. // Opposite to lower it.
  40. local nd to node(ApTime, 0, dV, 0).
  41. add nd.
  42. executeNode(nd).
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement