Jump to content

[WIN/MAC/LINUX] KSP Trajectory Optimization Tool v1.6.10 [Major LVD Improvements!]


Recommended Posts

19 minutes ago, CraigCottingham said:

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. :-(

The most recent compiled version of KSPTOT, v1.6.1, is only available for Windows using the R2017b MCR version.  (When a MATLAB application is set up to be deployed, it is tied directly to a particular operating system and MCR version.  KSPTOT v1.6.1 must use the Windows R2017b MCR, no other will work by definition.)  You're right in that there is a Mac version out there, but because @bk2w hasn't been around for awhile, that version has stagnated.  Unless you have a way to run Windows somehow (virtual machine?), you'll have to stick with the older KSPTOT version.  I'm sorry, I know that's a bummer.  You have no Windows-based computers around?

Link to comment
Share on other sites

11 minutes ago, jospanner said:

Just tried matlab & restarting, as well as moving to a new folder. Nada. Baffled. Windows did decide to update though.

Alright, how handy are you with Windows environment variables?  This may be what's happening: https://www.mathworks.com/matlabcentral/answers/387408-why-do-i-get-the-error-using-load-unable-to-read-file-filename-no-such-file-or-directory-when

Can you create that MCR_CACHE_ROOT system environment variable it talks about and point it a directory you create (maybe C:\MCR_Cache_Root" or something)?

Edited by Arrowstar
Link to comment
Share on other sites

29 minutes ago, jospanner said:

Just tried matlab & restarting, as well as moving to a new folder. Nada. Baffled. Windows did decide to update though. 

create a shortcut to the program .exe and run it, see if that works. @Arrowstar I did report this problem a while ago but after coming up with the shortcut workaround I kinda forgot to follow up on it and it seemed to have gone away as well. It did come back for me with 1.6 but I just kept using the workaround

Thanks for the file fix, I'll let you know how the ascent turns out with the thrust profile implemented

Edit: woah, getting some funky results for total thrust output. It's nearly correct for the first 5 seconds but then there should be a big drop when the radial boosters detach and for some reason the minimum thrust for the entire ascent doesn't fall below 94kN. I'm just going to redo the entire ascent...

Edited by Drew Kerman
Link to comment
Share on other sites

1 minute ago, jospanner said:

I just tried setting MCR_CACHE_ROOT to a directory in c:\windows\temp and that appears to have fixed it. Making a shortcut didn't work for me. I have no idea why this is happening, but now it works. :/ So uh, thank you!

Glad to hear it.  Unfortunately this is an issue between Windows and the MCR, so there's not much I can do to preempt the problem.  Glad you got it working in the end though!  Happy orbiting!

Link to comment
Share on other sites

rats, already managed to break something. I need to stop being so good at doing that ;) the Close button for the Edit Launch Vehicle window is borked again. Closed fine for me to save after I added the stages but then as soon as I finished adding all 4 engines the window was like "nope" - case file (also doing a better job now tracking which version this was built in)

Link to comment
Share on other sites

7 minutes ago, Drew Kerman said:

rats, already managed to break something. I need to stop being so good at doing that ;) the Close button for the Edit Launch Vehicle window is borked again. Closed fine for me to save after I added the stages but then as soon as I finished adding all 4 engines the window was like "nope" - case file (also doing a better job now tracking which version this was built in)

Can you walk me through how you set up the engines for that file?  Something is still going on with engine states being deleted when they shouldn't but I need more information in order to reproduce the error.

Link to comment
Share on other sites

1 hour ago, Arrowstar said:

You're right in that there is a Mac version out there, but because @bk2w hasn't been around for awhile, that version has stagnated.  Unless you have a way to run Windows somehow (virtual machine?), you'll have to stick with the older KSPTOT version.  I'm sorry, I know that's a bummer.  You have no Windows-based computers around?

Nothing but Apple laptops here, I'm afraid. I could run Windows in a VM, but then I'd need to have a Win64 license, and that's a whole other kettle of fish.

I'm going to give the suggested steps for running on Linux a go (either in a VM or using WINE directly in macOS), but at the moment I'm not optimistic that WINE can run Win64 executables.

Link to comment
Share on other sites

Just now, CraigCottingham said:

I'm going to give the suggested steps for running on Linux a go (either in a VM or using WINE directly in macOS), but at the moment I'm not optimistic that WINE can run Win64 executables.

Okay.  If you give this a go, please makes sure you download the correct MCR version.  I just noticed the instructions for that reference the R2015b version, not the correct R2017b version.

Link to comment
Share on other sites

1 minute ago, Arrowstar said:

Can you walk me through how you set up the engines for that file?  Something is still going on with engine states being deleted when they shouldn't but I need more information in order to reproduce the error.

I've been working on narrowing down to the bare minimum repro steps since I submitted the file and just nailed some down:

  1. launch LVD
  2. open launch vehicle editor
  3. open stage editor
  4. add new stage, leave all default and save
  5. close stage editor
  6. confirm launch vehicle editor can close okay
  7. open launch vehicle editor
  8. open engine editor
  9. add new engine, set to the newly added stage, change nothing else and save
  10. close engine editor
  11. you should now not be able to close launch vehicle editor

However this doesn't cause an error:

  1. launch LVD
  2. open launch vehicle editor
  3. open stage editor
  4. add new stage, leave all default and save
  5. close stage editor
  6. confirm launch vehicle editor can close okay
  7. open launch vehicle editor
  8. open engine editor
  9. add new engine, change nothing else and save
  10. close engine editor
  11. confirm launch vehicle editor can close okay
  12. open launch vehicle editor
  13. open engine editor
  14. edit new engine, change to newly added stage, save
  15. close engine editor
  16. confirm launch vehicle editor can close okay
Link to comment
Share on other sites

36 minutes ago, Drew Kerman said:

I've been working on narrowing down to the bare minimum repro steps since I submitted the file and just nailed some down:

  1. launch LVD
  2. open launch vehicle editor
  3. open stage editor
  4. add new stage, leave all default and save
  5. close stage editor
  6. confirm launch vehicle editor can close okay
  7. open launch vehicle editor
  8. open engine editor
  9. add new engine, set to the newly added stage, change nothing else and save
  10. close engine editor
  11. you should now not be able to close launch vehicle editor

However this doesn't cause an error:

  1. launch LVD
  2. open launch vehicle editor
  3. open stage editor
  4. add new stage, leave all default and save
  5. close stage editor
  6. confirm launch vehicle editor can close okay
  7. open launch vehicle editor
  8. open engine editor
  9. add new engine, change nothing else and save
  10. close engine editor
  11. confirm launch vehicle editor can close okay
  12. open launch vehicle editor
  13. open engine editor
  14. edit new engine, change to newly added stage, save
  15. close engine editor
  16. confirm launch vehicle editor can close okay

Alright, I found the issue.  It was basically just a typo in the code that handles generating new engines. :blush:  Anyway, I have corrected the issue and rebuilt the executable.  Since this was a bug fix only build, I just replaced the old pre-release 2 executable with this new one I built earlier today.  You can go ahead and re-download pre-release 2 and that should solve the issue, though it will not fix any currently broken engines in an existing MAT file.

Thanks for the help on this one!

Link to comment
Share on other sites

4 hours ago, CraigCottingham said:

Nothing but Apple laptops here, I'm afraid. I could run Windows in a VM, but then I'd need to have a Win64 license, and that's a whole other kettle of fish.

I'm going to give the suggested steps for running on Linux a go (either in a VM or using WINE directly in macOS), but at the moment I'm not optimistic that WINE can run Win64 executables.

Current Wine does support win64 in general, but I've tried a few times over the years to get this working and never had success. I have a sneaking (but entirely unfounded) suspicion that MathWorks go out of their way to make Matlab *not* work under Wine.

Link to comment
Share on other sites

57 minutes ago, russm said:

Current Wine does support win64 in general, but I've tried a few times over the years to get this working and never had success. I have a sneaking (but entirely unfounded) suspicion that MathWorks go out of their way to make Matlab *not* work under Wine.

Out of curiosity, if I could compile a Linux version, would that help Mac too?  I can't get MacOS but Linux is free and I wonder if my MATLAB install media has a Linux installer on it... I think it might.  I'll check. 

Link to comment
Share on other sites

Mac user here.

Saw KSPTOT on the official KSP blog and decided instant download... until this I saw this on the WINE site:

Quote

"OSX has a ABI incompatibility with Win64 - OSX overwrites a CPU register that Win64 applications expect to remain untouched. Apple can’t change the ABI because there are already 64 bit OSX apps that expect things to work that way."

:-(

 

1 minute ago, Arrowstar said:

Out of curiosity, if I could compile a Linux version, would that help Mac too?  I can't get MacOS but Linux is free and I wonder if my MATLAB install media has a Linux installer on it... I think it might.  I'll check. 

Yes, *I think* we could run a Linux version of KSPTOT via Homebrew or Macports.

Holding breath, thank you kind human for considering it.

Link to comment
Share on other sites

19 minutes ago, Arrowstar said:

Out of curiosity, if I could compile a Linux version, would that help Mac too?  I can't get MacOS but Linux is free and I wonder if my MATLAB install media has a Linux installer on it... I think it might.  I'll check. 

Yep, macOS people could run it in a VM without having to buy a windows license (and as a primarily Linux person I'd also be very happy)

13 minutes ago, Raptus said:

Saw KSPTOT on the official KSP blog and decided instant download... until this I saw this on the WINE site:

Quote

I *think* that's out of date and/or has been worked-around somehow, Wine64 is a thing on macOS these days.

15 minutes ago, Raptus said:

Yes, *I think* we could run a Linux version of KSPTOT via Homebrew or Macports.

Not via homebrew/macports, since KSPTOT relies on the Matlab runtime (which is binary-only). But a macOS user can run a Linux VM without having to shell out for a Windows license.

Link to comment
Share on other sites

On 1/5/2019 at 4:46 PM, Arrowstar said:

So if you have 9 of the same engines on your actual vehicle, just make one Super Engine with 9x the thrust and the same Isp. 

So I tried this and it didn't work as expected. Examples. In the case of 4xSRB I'm using 4 individual engines hooked up to a tank 4x the mass of a single SRB. I get very close to the speed and altitude from my actual launch plus close to the proper burnout time (a bit over a ms too early in LVD compared to actual). In 1xSRB I have a single engine with 4x the thrust (both sea level and vacuum) and 4x the ISP, but even though the burn time is the same, the rocket is traveling higher and faster. If you cut the ISP by a quarter to return it to the ISP of a single engine, then the burn time drops to just over 1s. Not sure what is happening here but I'll just move forward with the 4xSRB approach for now.

Link to comment
Share on other sites

2 minutes ago, russm said:

Yep, macOS people could run it in a VM without having to buy a windows license (and as a primarily Linux person I'd also be very happy)

I *think* that's out of date and/or has been worked-around somehow, Wine64 is a thing on macOS these days.

Not via homebrew/macports, since KSPTOT relies on the Matlab runtime (which is binary-only). But a macOS user can run a Linux VM without having to shell out for a Windows license.

Thank you for the clarifications.

I have been out of the terminal/emulation/virtual machine game for many muns.

Link to comment
Share on other sites

Also! Something weird I don't understand - in either example file, go into the Initial Spacecraft State and switch off the SRM-S engine. Somehow the script propagates and terminates within a second even though the 2nd event termination is defined to be 0 tank mass for the SRB-S tank that only the SRM-S engine draws from. GA output confirms the tank mass does not change so how is the script terminating without running into its default max 5s execution time?

Link to comment
Share on other sites

2 hours ago, Drew Kerman said:

So I tried this and it didn't work as expected. Examples. In the case of 4xSRB I'm using 4 individual engines hooked up to a tank 4x the mass of a single SRB. I get very close to the speed and altitude from my actual launch plus close to the proper burnout time (a bit over a ms too early in LVD compared to actual). In 1xSRB I have a single engine with 4x the thrust (both sea level and vacuum) and 4x the ISP, but even though the burn time is the same, the rocket is traveling higher and faster. If you cut the ISP by a quarter to return it to the ISP of a single engine, then the burn time drops to just over 1s. Not sure what is happening here but I'll just move forward with the 4xSRB approach for now.

The error is that your Isp needs to remain the same.  Multiplying it by 4x will give you the result you saw.

1 hour ago, Drew Kerman said:

Also! Something weird I don't understand - in either example file, go into the Initial Spacecraft State and switch off the SRM-S engine. Somehow the script propagates and terminates within a second even though the 2nd event termination is defined to be 0 tank mass for the SRB-S tank that only the SRM-S engine draws from. GA output confirms the tank mass does not change so how is the script terminating without running into its default max 5s execution time?

I'll take a look!  Sounds fishy to me.  Thanks for the report.

Link to comment
Share on other sites

2 minutes ago, Arrowstar said:

The error is that your Isp needs to remain the same

when the ISP was the same then why did the engines burn out in just over a second instead of the ~6 seconds they should have run? Did you return the ISP to the original values in the 1xSRB file and see this?

Also, working on tracking down a mass discrepancy that may have thrown off the results of my initial ascent analysis that I just recently added to that download file. Was working up a response about 30min ago when I noticed it

Edited by Drew Kerman
Link to comment
Share on other sites

Just now, Drew Kerman said:

when the ISP was the same then why did the engines burn out in just over a second instead of the ~6 seconds they should have run?

Also, working on tracking down a mass discrepancy that may have thrown off the results of my initial ascent analysis that I just recently added to that download file. Was working up a response about 30min ago when I noticed it

I'm not sure, I'll have to look at it tomorrow. :)

Link to comment
Share on other sites

35 minutes ago, Arrowstar said:

I'm not sure, I'll have to look at it tomorrow. :)

no problem I'm done for the night as well. I guess I kinda buried that in my implementation explanation but yea that's a possible issue I might have found

Figured out my mass discrepancy - I was getting the mass of my radial boosters by reducing the rocket in the VAB editor down to just those parts and then multiplying the mass by 4 - problem was since the boosters have a tweakscaled part on them the mass was not whole number so when I multiplied the rounded-up value I ended up with a bit more mass than intended. Was also mistakenly adding the mass of the radial decouplers to the first stage instead of dropping that mass with the radial boosters.

So yea here's an updated case file and excel report. Looks like the thrusting is spot on - yay! However I don't think LVD will ever do a good job compensating for a ballistic spin, which likely drags on the rocket enough to slow its ascent compared to the projected values. I'm interested in your opinion on whether the wobble evident in the rocket's actual ascent data (pitch & yaw) could cause the difference in the altitude, velocity and dynamic pressure. Plus the spin itself removes energy from the rocket

Also is it accurate to refer to the Yaw value as Heading?

*YAWN*

Edited by Drew Kerman
Link to comment
Share on other sites

17 hours ago, russm said:

I *think* that's out of date and/or has been worked-around somehow, Wine64 is a thing on macOS these days.

I was able to get as far as running the MCR installer on Wine, but then got an error message that the installer thinks it needs some administrator right that it thinks it doesn't have. I have filed a bug with Wine.

I, too, would like to see a Linux version. (The more the merrier, right?) Please let me know if there's anything I can do to help.

Link to comment
Share on other sites

6 hours ago, CraigCottingham said:

I was able to get as far as running the MCR installer on Wine, but then got an error message that the installer thinks it needs some administrator right that it thinks it doesn't have. I have filed a bug with Wine.

I, too, would like to see a Linux version. (The more the merrier, right?) Please let me know if there's anything I can do to help.

Well, it's not pretty, but...

7k3AdHo.png

@CraigCottingham, if you're interested and able, I'd like to tap you to test out the Linux version of KSPTOT, assuming you can?

EDIT: It lives!  (As a deployed Linux application.)

wRp4bth.png

EDIT 2: For anyone who wants to try it out, here's the link to KSPTOT v1.6.1 Linux.  Please make sure you read the readme file, as it explains how to actually run the application via the .sh script and what argument needs to be passed to said script for it to run.

Edited by Arrowstar
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...