Arrowstar

[WIN/MAC/LINUX] KSP Trajectory Optimization Tool v1.6.4 [New Vehicle Sizing Tool!]

Recommended Posts

2 hours ago, Arrowstar said:
18 hours ago, jmburbach said:

Would this tool allow me to plan arrival and entry (without orbital capture first) directly into another atmosphere such that the entry phase begins over a predetermined geographic position? Basically I'm looking for a way to help reliably plan an arrival and entry precisely enough that I can land reasonably near a target area.

The answer, at the moment, is sort of.   You have to use Mission Architect (MA) for it.  You can definitely do "vacuum" impact point calculations, that's easy.  (See the Mission Architect example included called "Mission to Minmus" or something to that effect.)  A vacuum impact point is the point at which a trajectory intersects the ground without accounting for atmospheric drag.  However, atmospheric modeling is somewhat primitive at the moment.  You could try using the aerobraking event type in MA, though I think that event doesn't like it when you never show up out of the atmosphere again.

I would start by just modeling your reentry using the two body assumption (so just a basic coast, and coast down to an altitude of 0), and then come up with a way to adjust your pre-entry orbit to account for the fact that drag will pull that impact point a bit closer to the point where you hit the atmosphere.  Honestly, depending on your flight path angle at entry interface, the vacuum impact point may not even be a terrible assumption.  Give it a go and let me know how it goes.  I'm happy to help you come up with a good solution if I can. :)

That sounds great, thank you! I'll definitely have a go at it and see how it plays out.

Share this post


Link to post
Share on other sites

Has anyone else experiences issues getting KSP TOT to work after updating to the new MATLAB runtime? I was running KSP TOT 1.5.7 with MATLAB 9.0 fine but it seems no matter what I do, I can't get 1.5.10 to launch. I receive no errors or warnings; it just does nothing. I've tried reinstalling the runtime several times but no luck. I believe KSP TOT can find the runtime because if I try to run it when they're not installed, I get the expected message about not being able to find v9.3 of the runtime. The KSP TOT log file is 0 bytes so the application isn't even launching and then failing.

Anyone have any ideas?

Share this post


Link to post
Share on other sites
1 hour ago, csatlos said:

Has anyone else experiences issues getting KSP TOT to work after updating to the new MATLAB runtime? I was running KSP TOT 1.5.7 with MATLAB 9.0 fine but it seems no matter what I do, I can't get 1.5.10 to launch. I receive no errors or warnings; it just does nothing. I've tried reinstalling the runtime several times but no luck. I believe KSP TOT can find the runtime because if I try to run it when they're not installed, I get the expected message about not being able to find v9.3 of the runtime. The KSP TOT log file is 0 bytes so the application isn't even launching and then failing.

Anyone have any ideas?

Did you upgrade to the MATLAB R2017b (9.3) runtime?  Can you verify that this is the version you have installed?  If you have other MCR versions installed, have you tried uninstalling them?  Have you restarted your computer since installing the R2017b MCR?

EDIT: You are running this on 64-bit Windows, right?  Mac and Linux are not supported.

Edited by Arrowstar

Share this post


Link to post
Share on other sites
On 9/16/2018 at 5:17 PM, Arrowstar said:

Did you upgrade to the MATLAB R2017b (9.3) runtime?  Can you verify that this is the version you have installed?  If you have other MCR versions installed, have you tried uninstalling them?  Have you restarted your computer since installing the R2017b MCR?

EDIT: You are running this on 64-bit Windows, right?  Mac and Linux are not supported.

Machine is Windows 10, 64-bit. Here are the steps I took to try and get it working (note I started with the MATLAB v9.0 runtime installed for TOT 1.5.7):

  • Uninstalled Runtime v9.0;
  • Restarted PC;
  • Installed Runtime v9.3;
  • Tried to run KSP TOT v1.5.10. Did not start but no errors/warnings;
  • Uninstalled Runtime v9.3;
  • Restarted PC;
  • Tried to run KSP TOT v1.5.10 to see if I'd get errors that runtime was missing (I did, so that's good);
  • Reinstalled Runtime v9.3;
  • Restarted PC;
  • Tried to run KSP TOT v1.5.10. Again, no errors/warnings and no message about missing Runtime (suggesting that it could find it OK??);
  • Reinstalled old Runtime v9.0 (now both 9.0 and 9.3 installed);
  • Restarted PC;
  • Tried KSP TOT v1.5.7 and it works fine.
  • Uninstalled Runtime v9.3;
  • Gave up and came here for advice...

Share this post


Link to post
Share on other sites
2 hours ago, csatlos said:

Machine is Windows 10, 64-bit. Here are the steps I took to try and get it working (note I started with the MATLAB v9.0 runtime installed for TOT 1.5.7):

  • Uninstalled Runtime v9.0;
  • Restarted PC;
  • Installed Runtime v9.3;
  • Tried to run KSP TOT v1.5.10. Did not start but no errors/warnings;
  • Uninstalled Runtime v9.3;
  • Restarted PC;
  • Tried to run KSP TOT v1.5.10 to see if I'd get errors that runtime was missing (I did, so that's good);
  • Reinstalled Runtime v9.3;
  • Restarted PC;
  • Tried to run KSP TOT v1.5.10. Again, no errors/warnings and no message about missing Runtime (suggesting that it could find it OK??);
  • Reinstalled old Runtime v9.0 (now both 9.0 and 9.3 installed);
  • Restarted PC;
  • Tried KSP TOT v1.5.7 and it works fine.
  • Uninstalled Runtime v9.3;
  • Gave up and came here for advice...

Hmm that is very strange.  Out of curiosity, is there another computer you can try on?  Also can I get the exact text of the error message?

Share this post


Link to post
Share on other sites

I noticed that it does take a long time for KSPTOT to show up the first time I run a new version.  Maybe check task manager to see if it is showing up and using CPU time even if the splash screen or gui doesn't show up for a while?

Edited by KC_073

Share this post


Link to post
Share on other sites
1 hour ago, KC_073 said:

I noticed that it does take a long time for KSPTOT to show up the first time I run a new version.  Maybe check task manager to see if it is showing up and using CPU time even if the splash screen or gui doesn't show up for a while?

As an FYI, this occurs the first time you run it because a bunch of files need to get unpacked.  After that, the executable just calls the already unpacked files and so it starts much quicker.  Unfortunately I don't have any way to influence how that works or put up a note to the user or anything like that.

Share this post


Link to post
Share on other sites
On 9/19/2018 at 10:06 AM, Arrowstar said:

As an FYI, this occurs the first time you run it because a bunch of files need to get unpacked.  After that, the executable just calls the already unpacked files and so it starts much quicker.  Unfortunately I don't have any way to influence how that works or put up a note to the user or anything like that.

Yep, figured that something like that was the case. It wasn't a complaint, just something to explore that might explain what might be going on - see if waiting a bit makes KSPTOT show up.

Share this post


Link to post
Share on other sites

Hi everyone!

Today I have a very special announcement related to the upcoming release of KSP Trajectory Optimization Tool.  Some of you will remember that a number of years ago I attempted to put together a tool for KSPTOT that would help optimize launch trajectories.  This problem is fundamentally different than spacecraft trajectory design and KSPTOT felt lacking without it.  However, the approach I used then was the wrong one and I ultimately shelved the idea because I could not get it to work.

After a fair bit of time, I'm excited to announce that I have rethought the idea from scratch and have begun working on what will be a feature of Mission Architecture known as Launch Vehicle Designer (LVD)!

7T4Pchz.png

The first thing that will strike you about LVD is that it looks very much like Mission Architect.  This is by design.  MA has a stable user community and a well-defined work flow.  I wanted people familiar with Mission Architect to be able to jump in with a general idea of where everything on the main UI was and what it did.  Everything from the mission script to the state displays to the graphical trajectory display will be familiar to existing MA users.  People should be able to jump in and start designing launch vehicles and optimizing their trajectories with a minimum of new knowledge.

I6nTkIE.png

In the "Launch Vehicle" menu is an option to edit your launch vehicle.  This is very similar to the Spacecraft menu in Mission Architect.  Here you define all the physical properties of your spacecraft.  Launch Vehicles (LVs) are made up of four components: stages, engines, tanks, and engine-to-tank connections (or 'connections').  This UI has buttons to help you edit each of these component types, as well as a handy display for showing critical launch vehicle information.

v3tTgpG.png

Stages are the basic building block of an LV.  As in KSP, stages are basically made up of tanks and engines.  A stage element also models all of the dry mass for that stage. Stages can be active or inactive.  Active stages are considered to still be part of the LV.  Inactive stages are not, and nothing attached to them (engines or tanks) will function as soon as the stage is inactive.  Inactive stage dry mass also is not counted.  Turning a stage "inactive" is a bit like tapping spacebar in KSP to fire a decoupler.

JSZykTi.png

Engines provide thrust at a specific impulse. As in KSP, both sea level and vacuum thrust and Isp are modeled.  Engines can also be active or inactive and this state can be switched on the fly in flight.  Inactive engines provide no thrust.

iM8uC6n.png

Tanks hold propellant.  Tanks are defined with an initial amount of propellant and that amount decreases as engines draw from it over time.

xhnNTbE.png

Engine to tank connections tell LVD which tanks every engine draws propellant from.  Engines decrease tank masses equally across all connected tanks by an amount specified by the thrust and Isp of the engine.  Multiple engines can draw from the same tank and multiple tanks can feed the same engine.  Like stages, connections can be turned on and off in flight.  This lets people model all sorts of complex behavior, including asparagus staging.

sXXHIoB.png

The initial state of your launch vehicle is defined not as an event (like in Mission Architect), but separately, also under the Launch Vehicle menu.  This is similar to the Set State event from MA, however.  You'll notice that you can define an orbit a variety of ways.  Right now, either Keplerian elements or latitude/longitude/altitude are supported.

Aerodynamics properties can also be set and adjusted on the fly in flight.

The Launch Vehicle and Stage States button allows you to define which stages, engines, and connections are active or inactive at the start of the mission.

160XFjn.pngzASLi16.png

If you tap the Edit Steering Initial State, it'll bring up a dialog box to define the initial orientation of the vehicle.  Like MA, all steering in LVD is proscribed (so no modeling of torque or anything goes on).  However, unlike MA, LVD tracks the full orientation of the vehicle.  You can do so using two different element sets: either the familiar roll/pitch/yaw, or the aerodynamics angles of bank, angle of attack, and side slip.  Note that the way the coordinate systems are defined, a pitch of -90 degrees is actually up and +90 degrees is down.  I'll need to put a note in this UI about that. :)

Each of the steering angles can be set and optimized independently, and each angle can vary in time using linear and acceleration terms.

HJswKsm.png

Throttle works similarly to steering.  A throttle setting of 1 means any active engine with fuel will provide full thrust, and 0 means no thrust.  Throttle can be varied in time using the same linear and acceleration terms steering uses.  All of these quantities can be optimized, too.

5dONXXs.png

Finally, events.  This is probably the biggest departure from the MA paradigm.  Every event uses the same structure.  Events are made up of two elements: the termination condition and the actions. 

The termination condition is like the "go to" element of MA coasts.  The propagator will propagate the orbit, with any thrust from the engines and drag from the air, until the termination condition is met.  Right now I think I only have termination conditions for duration, tank mass (useful for stopping when you run out of prop in a stage), and angle of attack.  I plan on getting true anomaly in there soon.

Actions are things that occur after the propagation of an event.  The picture shows two: setting an engine state to active, and adjusting the throttle model to something else.  You can also adjust the steering model, setting a stage active or inactive, and other things.

Anyway, that's all I can show tonight!  There's still plenty of work to be done.  The propagator needs some serious performance improvement help, the warnings and alerts need to be created, more termination conditions need to be created, and some other user friendly things need to be added.  But it's a good start! :) I do plan on releasing a pre-release as soon as I get the code to the point where the public can use it without it crashing or being excessively slow.

So, thoughts?

Share this post


Link to post
Share on other sites

When I installed KSP TOT (i followed the instructions properly) and opened the application, it said it couldn't find MALTAB 9.3. What's the problem?

Share this post


Link to post
Share on other sites
On 9/16/2018 at 3:08 PM, csatlos said:

Has anyone else experiences issues getting KSP TOT to work after updating to the new MATLAB runtime? I was running KSP TOT 1.5.7 with MATLAB 9.0 fine but it seems no matter what I do, I can't get 1.5.10 to launch. I receive no errors or warnings; it just does nothing. I've tried reinstalling the runtime several times but no luck. I believe KSP TOT can find the runtime because if I try to run it when they're not installed, I get the expected message about not being able to find v9.3 of the runtime. The KSP TOT log file is 0 bytes so the application isn't even launching and then failing.

Anyone have any ideas?

 

2 hours ago, Vprogramki said:

When I installed KSP TOT (i followed the instructions properly) and opened the application, it said it couldn't find MALTAB 9.3. What's the problem?

Could everyone that's been having issues with the MCR please give this possible solution from The MathWorks a try?

https://www.mathworks.com/matlabcentral/answers/343074-why-do-i-receive-could-not-find-version-x-x-of-mcr-when-running-my-compiled-app-and-mcr-is-instal

It involves adjusting some environment variables.  Be sure to restart your computer after you follow these instructions, and then report back letting me know if the issues persists or has been resolved.

EDIT: By the way, in the solution you have to specify the path to the MCR. The example they give is " C:\Program Files\MATLAB\MATLAB Compiler Runtime\v82\runtime\win64".  That "v82" probably needs to be something like "v93" for this version of KSPTOT, but please check the path yourself and verify that whatever you put into the environment variable is actually where the MCR is installed.

EDIT2: I just installed the MCR and checked myself.  I believe this is what you need to add to your Windows path: "C:\Program Files\MATLAB\MATLAB Runtime\v93\runtime\win64"

Edited by Arrowstar

Share this post


Link to post
Share on other sites
1 hour ago, Vprogramki said:

Actually, nevermind. I managed to fix the problem.

Can you share what you did to fix your problem?

Share this post


Link to post
Share on other sites
On 9/24/2018 at 8:35 PM, Arrowstar said:

So, thoughts?

*joyful screaming*

I can’t think of anything, likely will once I can try it out

*screaming continues*

Share this post


Link to post
Share on other sites
On 9/25/2018 at 3:35 AM, Arrowstar said:

So, thoughts? 

Does it work with RSS/RO/principia? :)

Also, the name somewhat confuses me. Is it a trajectory optimizer or launch vehicle optimizer? Because launch vehicle designer hints at the latter, imo.

Share this post


Link to post
Share on other sites
On 9/28/2018 at 11:49 AM, Mike` said:

Does it work with RSS/RO/principia? :)

Also, the name somewhat confuses me. Is it a trajectory optimizer or launch vehicle optimizer? Because launch vehicle designer hints at the latter, imo.

RSS/RO: Yes.  As with all elements of KSPTOT, LVD will use the same celestial body information provided by the user.  You just need to create a bodies.ini file with RSS values (the plugin KSPTOTConnect can do this, see the OP of this thread).

Principia: No.  But LVD is primarily a launch vehicle tool, where the main forces to model are central body gravity, drag, and thrust.  3rd body perturbations are much less significant than these.

Naming: Launch vehicle design and trajectory design go hand in hand.  You can't optimize the trajectory without a launch vehicle, and you can't optimize the launch vehicle without a basic idea of where the trajectory is going.  This sort of thing is an iterative cycle of designing the vehicle, optimizing the trajectory, and then changing the vehicle to get more performance and repeating.  So really, it's all of the above. :)

Share this post


Link to post
Share on other sites

Firstly, this is amazing!

Secondly I have been trying to use the departure burn calculator to ease myself into using this. The manoeuvre that is uploaded though has the right amount of dV but is placed at a location that means the the flight path is no where near a rendezvous with Duna.

  • I have successfully got the connector working and can pull my orbital details from KSP live and upload manoeuvres back to KSP.
  • I have already corrected my first mistake of using the wrong time setting
  • The manoeuvre gets placed on the orbit such that the burn is retrograde or another time radial in compared to Kerbins orbit.
  • I do know how to set up this transfer manually and can correct the node so it works, so I'm confident it's not orbital mechanics error on my part but more likely a user error with KSPTOT.

Any thoughts on what could be going wrong?

Edited by Kreggurree

Share this post


Link to post
Share on other sites
6 hours ago, Kreggurree said:

Firstly, this is amazing!

Secondly I have been trying to use the departure burn calculator to ease myself into using this. The manoeuvre that is uploaded though has the right amount of dV but is placed at a location that means the the flight path is no where near a rendezvous with Duna.

  • I have successfully got the connector working and can pull my orbital details from KSP live and upload manoeuvres back to KSP.
  • I have already corrected my first mistake of using the wrong time setting
  • The manoeuvre gets placed on the orbit such that the burn is retrograde or another time radial in compared to Kerbins orbit.
  • I do know how to set up this transfer manually and can correct the node so it works, so I'm confident it's not orbital mechanics error on my part but more likely a user error with KSPTOT.

Any thoughts on what could be going wrong?

The simplest thing to try is to see if moving the maneuver node around actually gets you to the target, Duna in your case.  If it does, then there's something wrong with how you're uploading it.  Make sure you're using the Time Past Periapsis upload option, make sure that the orbit you have in the game matches the orbit you have in KSPTOT, and make sure that the maneuver node Delta-V components are correct. 

If you still don't have any luck, please provide a screenshot that shows the problem (both of KSPTOT and of KSP with the node that isn't working), that would be great.  I'll see what I can do with it.  Alternatively, if you give me the KSP save file and the inputs you used to generate the Kerbin to Duna trajectory, I'll see if I can't recreate what you're going through and advise on how to use KSPTOT better.  Thanks!

Share this post


Link to post
Share on other sites

Hi everyone!

I have excellent news.  This afternoon I finished compiling what I am calling KSPTOT v1.6.0 pre-release 1.  This is the first version of KSPTOT with the new Launch Vehicle Designer (LVD) in place.  Since I know there are some who are eager to get using this functionality, here's the link: KSPTOT v1.6.0 pre-release 1

(EDIT: Hang on one second, I found a sort of big bug with the constraints UI.  Stand by...)

(EDIT: Okay, all clear.  Go redownload the ZIP file if you haven't already.)

To access LVD, start KSPTOT, go to the Tools -> Mission Planning -> Launch Vehicle Designer.

A few caveats:

  1. There's not really any way to get anything useful out of LVD at the moment.  You can certainly use it to design launch vehicles and create optimal ascent trajectories, but there's no Graphical Analysis support (yet), no outputs for roll/pitch/yaw profiles (yet), etc.
  2. There's no way to edit the way the integrator or optimizer work (yet). 
  3. The code does not currently handle sphere of influence changes (yet), so whatever body you start on is the one you're stuck around for the time being.  Mostly the vehicle attitude stuff makes this complicated.
  4. When you start LVD, there will be a pre-created mission profile in there.  I wanted to give everyone an idea of what a very basic launch vehicle and mission might look like.  This will be removed for the final v1.6.0 release and replaced with something more generic, just as Mission Architect is now.
  5. Some things are potentially very fragile and might cause crashes, but I couldn't tell you what they are... that's the point of giving it to everyone to play with lol.

Here's what I need from you if you decide to use LVD in this pre-release:

  1. If you find any bugs, please report them in this thread or on the Github.  Either way, I need to know what happened, how I can recreate it, a copy of the ksptot.log file, and if you can, the LVD *.MAT save file with the issue.
  2. If you see some functionality that you feel is missing, please report it here or on Github.  I need a good description of what you're looking for.  Examples of this I'm anticipating include event termination conditions and event actions.
  3. If you have any comments on usability or work flow, please just post those here.

And that's it!  I look forward to everyone giving this a try and helping me improve it for the upcoming v1.6.0 release.  @Drew Kerman, you can stop screaming now I think. :)

Edited by Arrowstar

Share this post


Link to post
Share on other sites
21 minutes ago, Drew Kerman said:

I'ma dig into this sometime this week for sure!

Sounds good.  Be warned: there are bugs! :)

Share this post


Link to post
Share on other sites

Quick update on Launch Vehicle Designer: I've changed the way the Euler angles steering law works for the next update.  What I released before used a Velocity (Inertial) Vector, Local Horizontal frame to compute yaw/pitch/roll.  As of now, it will use a "North-East-Down" frame.  The big difference here is that yaw is relative to north now and not the velocity vector.  So to launch east, you always use a 90 degree yaw angle.  Or roll to 90 degrees while pitched straight up, the bring the pitch down, same thing.

This just made a little more sense to me I think, I never did like your steering being tied to the inertial velocity vector like that. :)

Share this post


Link to post
Share on other sites

small update, since I said I was going to check out the pre-release this week. That's likely not going to happen. Having too much success adding new features to my KSA Ops Tracker to get things ready to resume launches by January. I'm going to probably hit trouble and get frustrated at some point as I'm working on more and more complicated new features so I'll check out the pre-release once my momentum breaks and I need a distraction

Share this post


Link to post
Share on other sites

Hey everyone!

Today I've created KSPTOT v1.6.0 pre-release 2.  This is the second pre-release with updates for the upcoming Launch Vehicle Designer feature I've been discussing.  The changes from the last pre-release to this one are too numerous to enumerate in full, so I won't even try.  However, you should find that everything is a bit more stable and there are more features.  The only other feature I want to get in is a Graphical Analysis tool for outputs.  However, that will need to wait on the next pre-release due to the complexity of that task.

LVD *.mat save files created with the first pre-release are not compatible with this release due to the massive changes in the code between releases.  Sorry about that.

As always, please let me know if you have any questions or if you find any bugs.  Thanks!

On 10/11/2018 at 5:12 PM, Drew Kerman said:

small update, since I said I was going to check out the pre-release this week. That's likely not going to happen. Having too much success adding new features to my KSA Ops Tracker to get things ready to resume launches by January. I'm going to probably hit trouble and get frustrated at some point as I'm working on more and more complicated new features so I'll check out the pre-release once my momentum breaks and I need a distraction

No worries.  Please make sure you take a look at the latest pre-release when you poke around with it.  Thanks! :)

Share this post


Link to post
Share on other sites

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.