# Space model transfer to moon displacement [closed]

I'm having a problem with the insertion from a LEO orbit into a moon orbit/ moon flyby in my gravity simulator. I use the calculations listed below. I think it is due to the fact that the moon pulls the object inwards as it gets to the moon, which has to be compensated for, though sadly I do not know how to tackle this problem. I got the formulas from StackExchange page
So far I have tried to calculate the gravitational potential energy of the insertion orbit, though not having any luck. I have tried manually adding a bit of deltav and got to see that about 5-16 would do the trick, depending on target altitude.
Would anyone have a good way of correcting for the moon's pull in the transfer calculation?
Images:
NOTE: the first two images are relative to the moon.

Calculations:
insertionheight = injected radius from moon (+moon.radius)
R1 = radius to LEO (from earth)
R2 = radius to Moon Orbit (from earth) + insertionheight
vLEO = Math.Sqrt((G * earh.mass) / R1)
vP = Math.Sqrt((2 * (R2-insertionheight) * G * relativeobj.mass) / (R1 * (R1 + R2-insertionheight)))
vInject = vP - vLEO
vLLO = Math.Sqrt((G * targetobj.mass) / (insertionheight))
vM = Math.Sqrt((G * relativeobj.mass) / (R2 - insertionheight))
vA = Math.Sqrt((2 * R1 * G * relativeobj.mass) / (R2 * (R1 + R2)))
vL = Math.Sqrt(Math.Pow(vM - vA, 2) + (2 * G * targetobj.mass) / (insertionheight))
vInsert = vL - vLLO
TOF = pi * Math.Sqrt(Math.Pow((R1 + (R2-insertionheight))/2.0, 3) / (relativeobj.mass*G))

The same but as typed in C#:

double R1 = (movedobj.location.placevector - relativeobj.location.placevector).Length;//Math.Sqrt(Math.Pow(movedobj.location.placevector.X - relativeobj.location.placevector.X, 2) + Math.Pow(movedobj.location.placevector.Y - relativeobj.location.placevector.Y, 2) + Math.Pow(movedobj.location.placevector.Z - relativeobj.location.placevector.Z, 2));
double insertionheight = 200000 + 1737000;
double R2 = (targetobj.location.placevector-relativeobj.location.placevector).Length + insertionheight;//Math.Sqrt(Math.Pow(targetobj.location.placevector.X - relativeobj.location.placevector.X, 2) + Math.Pow(targetobj.location.placevector.Y - relativeobj.location.placevector.Y, 2) + Math.Pow(targetobj.location.placevector.Z - relativeobj.location.placevector.Z, 2)) ;

double vLEO = Math.Sqrt((G * relativeobj.mass) / R1);
double vP = Math.Sqrt((2 * (R2) * G * relativeobj.mass) / (R1 * (R1 + R2)));
double vInject = vP - vLEO;
double vM = Math.Sqrt((G * relativeobj.mass) / (R2));
double vA = Math.Sqrt((2 * R1 * G * relativeobj.mass) / ((R2) * (R1 + R2)));
double vLLO = Math.Sqrt((G * targetobj.mass) / (insertionheight));
double vL = Math.Sqrt(Math.Pow(vM - vA, 2) + (2 * G * targetobj.mass) / (insertionheight));
double vInsert = vL - vLLO;
double TOF = pi * Math.Sqrt(Math.Pow((R1 + (R2- insertionheight))/2.0, 3) / (relativeobj.mass*G));
double ttransfer = (2 * pi - (pi - Math.Sqrt(G * relativeobj.mass / Math.Pow(R2, 3)) * TOF)) / (2*pi / ((2 * pi * R1) / (Math.Sqrt(G * relativeobj.mass / R1))) - 2 * pi / (2 * pi * R2 / (Math.Sqrt(G * relativeobj.mass / R2))));


Thanks all in advance.

## closed as unclear what you're asking by uhoh, peterh, Rikki-Tikki-Tavi, Steve Linton, Mark OmoJun 7 '18 at 15:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Cool images, but can you express an actual question using a sentence that ends in a question mark? Try to be as specific as possible in describing what you need from an answer. Also, are you using any propulsive maneuvers during Lunar approach to slow your craft down in order to be captured into orbit? Try to explain more clearly exactly what you are doing, and exactly what you expect to happen. – uhoh Jun 2 '18 at 2:40
• As can be seen in the calculations part, it calculates the first and second hohmannn transfer deltavs + the time taken to travel from burst1 -> burst2 + when to initiate burn (ttransfer). When it gets close to the moon, (where it gets too close due to moon's graviry) it will initiate the second burn to slow down towards the moon. – Stijn Jun 2 '18 at 6:23
• I'm recommending you clarify your question and make it easier for other people to read and see all of the information, so that you chances of getting an answer will improve. I'd recommend you make changes to the post, not just say "it's already there" in comments. Good luck! – uhoh Jun 2 '18 at 12:29
• I'm voting to close as "unclear what you are asking" because I can not figure out what you are asking. If someone else can understand, they'll leave a comment explaining, or they'll edit your question to clarify it. Right now I don't see any clear definition of a "burst" or a "burn", and despite the nice plots, no effort to clearly explain what you are doing. fyi "I have tried manually adding a bit of deltav and got to see that about 5-16 would do the trick, depending on target altitude." isn't clear to me at all. Anyone else? – uhoh Jun 7 '18 at 3:00
• "Would anyone have a good way of correcting for the moon's pull in the transfer calculation?" Well, what's wrong with it? How would you like it corrected? – Rikki-Tikki-Tavi Jun 7 '18 at 9:17