Jump to content

[WIN/MAC/LINUX] KSP Trajectory Optimization Tool v1.6.9 [New MATLAB Version!]


Recommended Posts

1 hour ago, Drew Kerman said:

can do. Will get around to it sometime today

it's called a floatcurve from what I understand. Should be a generic math concept no? I'm sorry for calling you out on this but it does sound a bit like you may be considering this more of a custom-built thing in the game rather than using already-established game and engine features

Oh, I believe you that it's built into the game directly.  As @Starwaster said, it seems like FloatCurve is a KSP/Unity concept.  The actual math behind it is that spline you mentioned a number of posts up.  As far as that goes, I don't actually have any formal math background in, but luckily MATLAB has a function for generating those types of splines so I will just call that and be good with it. :)

Link to comment
Share on other sites

19 minutes ago, Drew Kerman said:

okay here is all the data you should need: https://docs.google.com/spreadsheets/d/1YI48brqtkNyVC_WS9312pOkAnIR5zsgnWibapTYk_ck/edit?usp=sharing

0 MET is before ignition, then 0.25 MET is the first data point after the engine is running

Great, thanks!  Forgot to ask, could you put the floatCurve for the engine in that file too?  That way I can build the engine correctly in LVD.  :)

Link to comment
Share on other sites

Okay, the good news is that it was easier than I thought to built the throttle modifier tool.

NkKhfN4.png

The bad news is that something isn't right with the way I'm handing something because the results I'm getting really aren't even close.

UTuc88y.png

I'm the blue data, you're the orange data.

There is clearly something I don't understand about what KSP is doing.  Unfortunately the KSP API and the Unity API documentations are no help.

Let's try this before I go digging another way: can you rerun your same test from before but this time set the  float curve to be all 1.0s for the throttle modifiers?  So replace the 0.46 and 0.1 with 1.0.  Then provide me that data on a different tab of the same workbook you linked before and I'll see how well I match up with that.  If it's perfect then I'm all set and I know the issue is with the float curve.

Btw, is the total mass of the propellant in the tank for this thing that initial 0.794999927 mT?

EDIT: Also could I see the part cfg file the rocket you're using that shows that floatcurve table we've been talking about?

Edited by Arrowstar
Link to comment
Share on other sites

Welp, I think I figured it out.  Boy, this was one of the weirdest problems to dig into.  There's basically no information out there on how KSP uses those animation curves and basically no information on how Unity uses them either!  I got lucky with that KSP float curve viewer thing for Unity.  Studying the curve you gave me, I realized that there was a constraint on the derivative of the right hand side of the curve to be 0.  I had to go find some custom code to deal with that, but once I did, the results are more or less spot on.

upHL5yS.png

I'm going to call this "good enough for government work" for the moment, create a new KSPTOT pre-release build some time today, and let you tell me how it performs.  It's not perfect, but it looks like it nails the engine shutdown to within a tenth of a second or so and the tank mass is very nearly the same.  My guess is that there is something else going on with the way you set things up in KSP vs. the way I'm modeling the burn.  I'm not sure what that would be, though.

Anyway, I'm hoping this is more or less finished now lol. :)

Link to comment
Share on other sites

1 hour ago, Arrowstar said:

My guess is that there is something else going on with the way you set things up in KSP vs. the way I'm modeling the burn

Could maybe be something to do with the extra floatcurve tangent parameters I can include with the keys but didn't? I've not seen any other SRB profile examples use them either but perhaps their default setting is not what would be expected - and lack of documentation would compound the issue

I wish that reference thread I linked to still had the images. I tried reading it but couldn't really make sense of what was being discussed without the visuals

Edited by Drew Kerman
Link to comment
Share on other sites

6 minutes ago, Drew Kerman said:

Could maybe be something to do with the extra floatcurve tangent parameters I can include with the keys but didn't? I've not seen any other SRB profile examples use them either but perhaps their default setting is not what would be expected - and lack of documentation would compound the issue

I wish that reference thread I linked to still had the images. I tried reading it but couldn't really make sense of what was being discussed without the visuals

I would leave the tangents off.  Right now I don't have a way to enter those anyways (though I suppose I could).  I mean, would you want the ability to enter the tangents directly or are you fine with allowing KSP/Unity to handle that smoothly?

Link to comment
Share on other sites

Just now, Arrowstar said:

I would leave the tangents off.  Right now I don't have a way to enter those anyways (though I suppose I could).  I mean, would you want the ability to enter the tangents directly or are you fine with allowing KSP/Unity to handle that smoothly?

well what I was saying is that I have no idea how to use the tangents - that post I referenced may have given me a better idea if I had the graph images to look at. Anyways, if you don't think the tangents could be an issue I would just as soon leave them alone since I haven't seen anyone else bother with them for their own SRB curves

Link to comment
Share on other sites

9 minutes ago, Drew Kerman said:

well what I was saying is that I have no idea how to use the tangents - that post I referenced may have given me a better idea if I had the graph images to look at. Anyways, if you don't think the tangents could be an issue I would just as soon leave them alone since I haven't seen anyone else bother with them for their own SRB curves

That sounds fine to me, we'll just leave it as is for now. :)

Link to comment
Share on other sites

oh yea forgot to tell you about that, I saw it on twitter. KSA gave you their recommendation of course.

itty bitty little change I'd like you to make in the latest build - I just realized the About dialog still uses my old (generic online, really) KSP username. Can you change Gaiiden to Drew Kerman? Thx!

Link to comment
Share on other sites

1 hour ago, Drew Kerman said:

itty bitty little change I'd like you to make in the latest build - I just realized the About dialog still uses my old (generic online, really) KSP username. Can you change Gaiiden to Drew Kerman? Thx!

Done for the next pre-release.  Speaking of which:

Please find attached KSPTOT v1.6.2 pre-release 1.  The only major update to this release is the inclusion of the ability to add a spline into the engine model which modifies the total thrust and mass flow rate of that engine based on propellant remaining left in the tanks. Please let me know if you find any bugs or have any questions.  Thanks!

Link to comment
Share on other sites

Alright two minor problems:

  • If you load a file with non-sequential events right after loading LVD, the button to delete the events remains disabled until you add an event. Likewise, if you load a file with no non-sequential events or create a new file the button remains enabled
  • Thrust profile window needs Esc key support

One major problem:

  • if I set a thrust profile for an engine it seems to apply itself to all engines. Even more bizarre, the profile applies itself or at least shows up when I create a new case file entirely and edit the default engine. I had to restart the entire program, not just LVD, to open up the thrust profile window and not see the profile I already created. So repro steps in case that wasn't clear:
    1. load LVD
    2. add a key to the thrust profile of the default engine
    3. create a new file
    4. open the default engine and still see the same thrust profile
Edited by Drew Kerman
Link to comment
Share on other sites

9 hours ago, Drew Kerman said:

I wish that reference thread I linked to still had the images. I tried reading it but couldn't really make sense of what was being discussed without the visuals

The images are present in archive.org's cache of the thread:

http://web.archive.org/web/20170607054017/https://forum.kerbalspaceprogram.com/index.php?/topic/84201-info-ksp-floatcurves-and-you-the-magic-of-tangents/

Link to comment
Share on other sites

4 hours ago, Drew Kerman said:

Alright two minor problems:

  • If you load a file with non-sequential events right after loading LVD, the button to delete the events remains disabled until you add an event. Likewise, if you load a file with no non-sequential events or create a new file the button remains enabled
  • Thrust profile window needs Esc key support

One major problem:

  • if I set a thrust profile for an engine it seems to apply itself to all engines. Even more bizarre, the profile applies itself or at least shows up when I create a new case file entirely and edit the default engine. I had to restart the entire program, not just LVD, to open up the thrust profile window and not see the profile I already created. So repro steps in case that wasn't clear:
    1. load LVD
    2. add a key to the thrust profile of the default engine
    3. create a new file
    4. open the default engine and still see the same thrust profile

First two issues are fixed for the next release.

The third issue is something I've been fighting since I started this.  There is something about... something with the way I set up the classes to handle the throttle modifier curve that persists in some weird way, even when you create a new LVD case.  I've run into this too.  I thought I had the issue resolved but I guess not.  It's really strange and I've never seen anything like it.  I'll keep working on it.  Thanks for the bug report!

EDIT: Actually figured it out.  I was trying to be too smart.  Basically what happened is that MATLAB does this thing to save time where if you define an object with a property and give that property a default value, it will use that exact value for each instance of that object created.  And for objects, which is what I'm using for most of the code in LVD, this means it's the exact same object, everywhere.  This is why you were seeing the bizarre behavior persist across different case files.  Anyway, I removed that default and populate it somewhere that doesn't make it do that, so issue resolved. :)

Edited by Arrowstar
Link to comment
Share on other sites

18 hours ago, Arrowstar said:

Hey everyone, check this out!  KSPTOT was featured yesterday as part of Squad's "Star Mods" weekly feature.

How awesome is that?  I'm super excited for more people to find out about KSPTOT. :)

Holy cow, I only just now learned about this today. It looks like it's going to be the top of my "mods I need to have but didn't realize it" list. :-)

Link to comment
Share on other sites

42 minutes ago, CraigCottingham said:

Holy cow, I only just now learned about this today. It looks like it's going to be the top of my "mods I need to have but didn't realize it" list. :-)

Sounds great, let me know if I can help you get up to speed on anything. :)

In other news, @Drew Kerman, the bugs you found should be fixed in KSPTOT v1.6.2 pre-release 2.  Enjoy. :)

Link to comment
Share on other sites

2 hours ago, Arrowstar said:

Sounds great, let me know if I can help you get up to speed on anything. :)

Grr. The 2013a release of Matlab doesn't want to install on my Macintosh, and to download the 2018a release they want a license number or activation key. Maybe I'm trying to download the wrong thing?

Update: Okay, I think I found it. The link to the latest version of MCR (R2018b 9.5) is http://ssd.mathworks.com/supportfiles/downloads/R2018b/deployment_files/R2018b/installers/maci64/MCR_R2018b_maci64_installer.dmg.zip

Update 2: KSPTOT 1.6.1 doesn't work with MCR 2018a. :-(

Quote

dyld: Library not loaded: @rpath/libmwmclmcrrt.8.1.dylib

According to the notes at https://www.mathworks.com/products/compiler/matlab-runtime.html, nothing older than R2016b 9.1 supports any version of macOS equal to or newer than 10.12 (Sierra). I'm downloading R2016b 9.1 from http://ssd.mathworks.com/supportfiles/downloads/R2016b/deployment_files/R2016b/installers/maci64/MCR_R2016b_maci64_installer.dmg.zip and giving that a go.

Update 3: R2016b 9.1 doesn't work, either. It supplies `libmwmclmcrrt.9.1.dylib`, which is missing at least one symbol for which the application is looking. I'll contact Bk2w separately to see if the app can be rebuilt against a newer version of MCR.

Edited by CraigCottingham
Answered my own question
Link to comment
Share on other sites

1 hour ago, Arrowstar said:

Sounds great, let me know if I can help you get up to speed on anything. :)

In other news, @Drew Kerman, the bugs you found should be fixed in KSPTOT v1.6.2 pre-release 2.  Enjoy. :)

I have to step out for a while, if you have a chance to take a look this case file is no longer finishing its simulation after loading with the newest release. Was built using the final KSPTOT v1.6.1 release and loaded fine in the first pre-release for v1.6.2. If I don't hear from you by the time I get back that the file can be fixed I will just rebuild the whole thing from scratch. Prob a good idea anyways

Link to comment
Share on other sites

17 minutes ago, Drew Kerman said:

I have to step out for a while, if you have a chance to take a look this case file is no longer finishing its simulation after loading with the newest release. Was built using the final KSPTOT v1.6.1 release and loaded fine in the first pre-release for v1.6.2. If I don't hear from you by the time I get back that the file can be fixed I will just rebuild the whole thing from scratch. Prob a good idea anyways

Not sure what happened, but none of your engines had throttle curve objects in them for some reason.  I added default ones back in that you'll have to repopulate.  Here's the file.  I tried creating and copying a bunch of engines from scratch and they all had curves so I'm not sure how yours didn't, but it could have to do with the fact that it was created on an older version.  No idea really.

Link to comment
Share on other sites

Hii...
I ran the program successfully last night, but now I am getting this error on loading, after which nothing happens.

"Unable to read file 'splashScreenGUI.fig'.
No such file or directory.
Error in => projectMain.m at line 21"

I am running Windows 10. Any idea what this is? The file named does not exist in the download, from what I can tell.

Link to comment
Share on other sites

Well, (insert various curse words here). KSPTOT doesn't work with recent versions of MCR, and older versions of MCR don't work with recent versions of macOS. Bk2w doesn't appear to be a member of the forums anymore, so unless I buy a license for MATLAB or find someone else who has one, I (and other macOS users) may be out of luck. :-(

Link to comment
Share on other sites

2 minutes ago, jospanner said:

Hii...
I ran the program successfully last night, but now I am getting this error on loading, after which nothing happens.

"Unable to read file 'splashScreenGUI.fig'.
No such file or directory.
Error in => projectMain.m at line 21"

I am running Windows 10. Any idea what this is? The file named does not exist in the download, from what I can tell.

Well that's a new one.

That file is embedded in the executable you have, so no worries about not seeing it.  Try redownloading the KSPTOT package and run that executable from a different location.  Or give your a computer a restart first.  That splash screen UI should never go missing, so maybe something with the MATLAB Compiler Runtime got messed up and we just need to clear that.

Give these things a try and let me know if you're still having issues.  Thanks!

Link to comment
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.

×
×
  • Create New...