Jump to content

Torch-Ship Trajectory Plotter


nubeees

Recommended Posts

I've been recently experimenting around with Interstellar mod's kerbstien drive and other ultra-high ISP engines which let you accelerate during timewarp, and I made a discovery: Eyeballing Brachistochrone trajectories is an absolute nightmare, especially if your target body is behind your starting location.

I've seen a solar sail navigator addon before that plotted trajectories for solar sails. I'm not sure if it's still around or even compatible with the current version of KSP, but between that and seeing mods such as principa in action, I know it's possible to draw curves in map view that don't strictly adhere to orbital paths.

Would it be possible to write a addon which at the very least assists with Brachistochrone trajectory plotting? I'd be willing to assist in writing it, but I really don't know where I'd even start, especially when it comes to the math.

(Bonus points if it lets you schedule a kerbal alarm clock alarm to tell you when to start your deceleration burn!)

One very fortunate thing is I'd imagine KSP's simplified single-point gravity system will simplify the math dramatically.

Link to comment
Share on other sites

12 hours ago, zer0Kerbal said:

if you use KOs - check out MechVal.

thought solar sail navigator (the plugin you are referring to) was absorbed into KSPIe.

I thought that was for achieving escape velocity with low thrust. 

This is the opposite end of the spectrum.

Link to comment
Share on other sites

5 hours ago, Nightside said:

@nubeees, I'd love to see this capability from a mod as well, but unfortunately I don't have the chops.

It might help to define the terms and the use... 

Or just let Scott Manley do it.

@zer0Kerbal, check this out:

he does a good job explaining it. I've done it manually in game before. My understanding is that there is one if not more versions of the epstein drive from The Expanse (or similar) being developed in game. I am confident they would need something like what you are requesting as well.

doing this in kOS would be relatively easy - as a script. Like Scott Manley says - calculate Acc - factor in distance - point at target - strap in, go; when elapsed time is 1/2 of total time (less time to turn around) flip and go antitarget/retrograde target - and adjust. This is a job for a PID. Beyond my current ability to program, else I'd do it because I also would like to see this in game.

so to help your definition:

Quote

 

  1. add node for start (best to not start from launch - Scott Manley explained it)
  2. burn vector is target.
  3. burn.
  4. calculate acceleration and time to impact/closest approach
  5. add node at halfway less time to turn to anti-target/retro-target
  6. turn at node
  7. calculate and add new node once turned around
  8. burn.
  9. adjust.

 

variables needed/things you would have to know:

  • max Acceleration of vessel
  • max G permitted
  • time-to-turn
  • starting point in space
  • target

 

3 hours ago, Nuke said:

id love something like this. the maneuvering node system was made for homann transfers not brachistochrone trajectories.

agree.

Link to comment
Share on other sites

Other considerations are vessel current/starting velocity and target object velocity. I found this out the hard way :P

For paticularly large distances- such as a transfer from Jool to Kerbin- the target location upon arrival will be vary from when you started to the extent that the transfer simply does not succeed.

... Or maybe I'm just stupid and have been doing my brachistochrone trajectories wrong

Link to comment
Share on other sites

2 minutes ago, nubeees said:

Other considerations are vessel current/starting velocity and target object velocity. I found this out the hard way :P

For paticularly large distances- such as a transfer from Jool to Kerbin- the target location upon arrival will be vary from when you started to the extent that the transfer simply does not succeed.

... Or maybe I'm just stupid and have been doing my brachistochrone trajectories wrong

:D

Link to comment
Share on other sites

@nubeees Notice KSPIE Fusion engine has a simplistic build in torch ship planner. Basicly you can set a maximum speed or fuel percentage  after which the vessel will stop

I guess I can improve it with a DeltaV limiter, where you can simply set 50% deltaV acceleration before it will auto shut down, I think in most cases this will be more than enough

Edited by FreeThinker
Link to comment
Share on other sites

2 hours ago, Xurkitree said:

@nubeeesThe mod you're looking for is Transfer Window Planner.

Input destination and final orbits, and give a time range and it'll give a trajectory. Impulsive, but it should suit your needs.

Are you sure this works for Brachistochrone (shortest time) trajectories? 

These tools are usually for Hohmann (lowest energy) transfers.

Link to comment
Share on other sites

accelration is easy, the main problem is deceleration, I guess its very similar to a suicide burn, with a very low gravity, so I guess you can use the suicide match to determine when to decelerate

Perhaps you can use this calculator: https://www.desmos.com/calculator/ms0zpkjkvp

Quote

Maths incoming.

We're going to assume constant acceleration. In reality it wouldn't be quite constant, since the mass of your ship is decreasing, making your engines accelerate you more, and you're getting closer to the planet, making gravity accelerate you more, but we're going to assume that these are both minor enough to ignore.

First we need to know the acceleration of the spacecraft. I'm going to use up as the positive direction, so the acceleration of the spacecraft is going to be


a = aEngine-g  

where g is the acceleration due to gravity where you are, and aEngine is the thrust of the engine you're using divided by the thrust. Hopfully you get a positive number...if not, you have problems.

Next we need to know how long it will take to stop. We get this from the equation


v = v_0 + at  

Solving for t:


t = (v-v_0)/a  

Since we're going down, v_0 is a negative number, and since we want to stop, v is 0. So basically, it works out to (initial speed)/(net acceleration) is the time that you need to stop.

Lastly we want to know how far we will go in that time. Under constant acceleration


dist = v_avg*t  

and since we're coming to a rest, v_avg is just half of the initial velocity.

Combining those, we get


dist = (v_0/2)*(-v_0/a) = -(v_0)^(2)/2a.

Plug in how fast you're going, and the net acceleration of your craft, and you get how far you will go before you stop (the negative sign is there just because you're going down). Now the tricky thing is that as you go down, your initial velocity also increases. When I wrote a kOS script to do this I just had it rapidly checking using the actual current velocity, but if you want to do the calculation once and be done it becomes much harder if you need to account for the changing initial velocity based on altitude. Depending on how fast you're going, though, your velocity might not change enough in the relevant range to matter.

see also : https://www.reddit.com/r/KerbalAcademy/comments/4c42rz/maths_help_calculating_when_to_suicide_burn/

 

I found a spreadsheet which might be usefull:

https://www.dropbox.com/s/0lq80ruzs8vt8az/KSP Full Throttle Burn v0 (Autosaved).xlsm

WLBzw7i.png

Edited by FreeThinker
Link to comment
Share on other sites

20 minutes ago, Nightside said:

Are you sure this works for Brachistochrone (shortest time) trajectories? 

These tools are usually for Hohmann (lowest energy) transfers.

Yes. Just input a travel time required, say like 4 days or 40 days or 400 days and it'll plot the lowest DV required for such a transfer.

Another way is that you can have a specific date of arrival or departure, and it'll plot the lowest DV required for such a transfer. 

 

Link to comment
Share on other sites

15 minutes ago, Xurkitree said:

Yes. Just input a travel time required, say like 4 days or 40 days or 400 days and it'll plot the lowest DV required for such a transfer.

Another way is that you can have a specific date of arrival or departure, and it'll plot the lowest DV required for such a transfer. 

 

I gues you don't understand what a Brachistochrone trajectory is, the goal is not to get their with the minimum amount of deltaV, it is the exact opposite, its to spend the MAXIMUM amount of DeltaV to get to your destination the fastest. The Problem is to accelerate , reverse and decelerate at the exact right moment. What I need is the math

Edited by FreeThinker
Link to comment
Share on other sites

7 minutes ago, FreeThinker said:

I gues you don't understand what a Brachistochrone trajectory is, the goal is not to get their with the minimum amount of deltaV, its the exact opposite, its to spend the MAXIMUM amount of DeltaV to get to your destination the fastest. The Problem is to accelerate , reverse and decelerate at the exact right moment. What I need is the math

Like I said, you can input a specific time frame for the transfer as well. It'll just give a initial burn vector and a final burn vector which one can execute. Yes, its made for Hohmann transfers, but it will do the trick.

Edited by Xurkitree
Link to comment
Share on other sites

1 hour ago, Xurkitree said:

Like I said, you can input a specific time frame for the transfer as well. It'll just give a initial burn vector and a final burn vector which one can execute. Yes, its made for Hohmann transfers, but it will do the trick.

That’s a clever work around, i’ll Give it a try.

Link to comment
Share on other sites

1 hour ago, Nightside said:

That’s a clever work around, i’ll Give it a try.

Do tell the results!

Edit: I tried that workaround using mechjeb; probably need to use TWP because Mechjeb's nodes did not behave when used with such parameters

I think a modification of mechVal might be a promising solution, for something closer to my original intent.

Also, thank you to everyone so far! Discussion on this thread has been several AU more productive than I expected! :)

Someone mentioned a comparison of the deceleration burn to a suicide burn. I found this to more or less be true; except you must account for the gravity of the sun. Not entirely sure how to do that myself.

Edited by nubeees
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...