Jump to content

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


Recommended Posts

58 minutes ago, Arrowstar said:

Thanks for the visibility!  Sorry I haven't been able to code as much over the past few weeks, personal life has been crazy.

No worries, KSPTOT as-is right now has everything I want and need and I can work around all the minor issues that I've noted here that aren't fixed yet

Link to comment
Share on other sites

Hi everyone,

Tonight I'm releasing KSPTOT v1.6.5 pre-release 8.  Here's the change log:

  • MA: Marker type for mission animator added.
  • Fix to SFS file read.  Bug was causing some vessels to not get found in the file.
  • LVD: Addition of a new propagator type, "Two Body Motion."  This change also includes a number of backend reworks to incorporate a new way to propagate spacecraft orbits and a generic interface for adding new propagator types in the future.  See discussion below.

Okay, so what's this about a new propagator type in LVD?  Let me show a picture of the updated Edit Event dialog box to use a talking aid.

AgC3XY5.png

See the new Force Model Propagator entry in that drop down menu on the right?  You can now change that to either "Force Model Propagator" or "Two Body Propagator."  What's the difference? The force model propagator is what you're used to in LVD right now.  It includes the full suite of force models that are in LVD: gravity, drag, lift, thrust, etc.  The two body propagator is strictly gravity from the central body.  Why use this propagator?  Because in cases where you really are only under the influence of central body gravity, the equations of motion simply significantly (basically, mean_anomaly_dot = n, where n is a constant) and the integration goes much, much faster.  This is a good way to speed up the long coasts around the Sun or whatnot and make the whole case run faster.

Let me know if you have any questions! :)

Link to comment
Share on other sites

On 2/15/2020 at 4:02 PM, stankwoo said:

Before the first maneuver which is the mun injection, it says my second maneuver to circularize after return from Mun will put me at 75KM around Kerbin. After the burn the Pe goes to 156,213KM.

@stankwoo, did you ever figure out what is going on with your issue?

Link to comment
Share on other sites

Hey guys, just wanted to provide a behind the scenes heads up regarding some new functionality that may appear in the future if needed.  One of the things I've been dreading about KSP 2 is that I'm almost sure that bodies will have axial tilt.  If this happens, and it will I believe, then KSPTOT as it stands today would not be able to provide accurate orbit information when moving from SoI to SoI.  Over the past few months, I've slowly been incorporating the new reference frame system into various bits of KSPTOT in order to handle this.  As of tonight, I believe that KSPTOT can now handle axial tilt in the four applications where it would be needed:

  • Compute Departure
  • Multi-fly Maneuver Sequencer
  • Mission Architect
  • Launch Vehicle Designer

There is no axial tilt term in the bodies.ini file at this time.  The code assumes at the moment that all bodies have spin axes aligned with the global [0;0;1] vector.  This can change fairly easily, though, and if it's requested, I could make it a part of the next release.

Why is all this necessary?  Right now in KSP, all spin axes are aligned to that aforementioned unit vector.  Kerbin spins around the same axis as Duna, etc.  In KSP 2, I'm concerned this may not be true anymore.  If it does happen, then all orbit measurements which are relative to equators (inc, RAAN, argument of periapsis) would be wrong compared to what you'd see in the game.  They wouldn't be wrong outright, but the numbers would be with respect to a different reference frame, and this would confuse players, I believe.  Therefore it had to be tackled, preferably before the KSP 2 release.

No one should see any impact to any calculation as of today.  Right now, those rotation matrices that handle the spin axis stuff are all identity matrices, so no rotation occurs.  However, if you do see something off, please let me know, as it could be a bug in the implementation.  Thanks!

Link to comment
Share on other sites

1 hour ago, Arrowstar said:

@Drew Kerman: Have I missed any bug reports or feature requests you've posted over the past few weeks or am I caught up?

just this one:

And as well, less important but if you ever do feel like looking over some flight analysis I'm still not quite able to wrap my head around what was going on with this flight

 

Link to comment
Share on other sites

On 2/9/2020 at 12:05 AM, Drew Kerman said:

here's a strange one, possible edge case. MAT files. Start with #1

  1. add a coast to ascending node
  2. convert the AN coast to UT and back off 5min
  3. add a coast to function value of 500km altitude (my comms range)
  4. add a coast to Pe
  5. add a coast to function value of 500km altitude
  6. advance script to the Pe coast event
  7. open the GA tool
  8. check the option to display Pe crossings
  9. plot and see Pe line displayed

Now repeat these steps for files #2 and #3. Both fail to show the Pe crossing. I upped the log entries to 5000 and 10000 and still got nothing displayed. It's not like the trajectory changed much between #1 and #2 or #3

Resolved for next release.

Link to comment
Share on other sites

5 hours ago, Drew Kerman said:

@Arrowstar critical issue in the latest pre release - I can't "Save & Close" the LVD stage editor, either from editing an existing stage or creating a new stage

Woah, actually I had to roll back to PR6 to get it to work again

Do you have a ksptot.log file with an error message I can see?  Thanks for the report. :)

EDIT: Nevemind, issue resolved.  I'll put out a new build tonight if I'm able.  Sorry for the inconvenience.

Edited by Arrowstar
Link to comment
Share on other sites

5 hours ago, Arrowstar said:

Here is KSPTOT v1.6.5 pre-release 9 with the fix for your bug, hopefully

'fraid not. Here is the log:

Spoiler

Error using isempty
Not enough input arguments.

Error in InitialStateVariable/isVarContainedWithin (line 129)


Error in InitialStateModel/isVarFromInitialState (line 211)


Error in getEventNumberForVar (line 27)


Error in OptimizationVariableSet/sortVarsByEvtNum (line 177)


Error in OptimizationVariableSet/addVariable (line 22)


Error in lvd_EditStageGUI>lvd_EditStageGUI_OutputFcn (line 111)


Error in gui_mainfcn (line 264)


Error in lvd_EditStageGUI (line 42)


Error in lvd_EditStagesGUI>stagesListbox_Callback (line 116)


Error in gui_mainfcn (line 95)


Error in lvd_EditStagesGUI (line 42)


Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)lvd_EditStagesGUI('stagesListbox_Callback',hObject,eventdata,guidata(hObject))

Error using uiwait (line 81)
Error while evaluating UIControl Callback.

Error using isempty
Not enough input arguments.

Error in InitialStateVariable/isVarContainedWithin (line 129)


Error in InitialStateModel/isVarFromInitialState (line 211)


Error in getEventNumberForVar (line 27)


Error in OptimizationVariableSet/isVarEventOptimDisabled (line 200)


Error in OptimizationVariableSet/getTotalScaledXVector (line 43)


Error in LaunchVehicleScript/executeScript (line 235)


Error in ma_LvdMainGUI>propagateScript (line 130)


Error in ma_LvdMainGUI>runScript (line 110)


Error in ma_LvdMainGUI>editLaunchVehicleMenu_Callback (line 455)


Error in gui_mainfcn (line 95)


Error in ma_LvdMainGUI (line 42)


Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_LvdMainGUI('editLaunchVehicleMenu_Callback',hObject,eventdata,guidata(hObject))

Error using waitforallfiguresclosed (line 9)
Error while evaluating Menu Callback.

all I did was open KSPTOT, Open LVD, navigate to the stage editor and try to save & close without even changing anything

Edited by Drew Kerman
Link to comment
Share on other sites

8 hours ago, Drew Kerman said:

'fraid not. Here is the log:

  Hide contents

Error using isempty
Not enough input arguments.

Error in InitialStateVariable/isVarContainedWithin (line 129)


Error in InitialStateModel/isVarFromInitialState (line 211)


Error in getEventNumberForVar (line 27)


Error in OptimizationVariableSet/sortVarsByEvtNum (line 177)


Error in OptimizationVariableSet/addVariable (line 22)


Error in lvd_EditStageGUI>lvd_EditStageGUI_OutputFcn (line 111)


Error in gui_mainfcn (line 264)


Error in lvd_EditStageGUI (line 42)


Error in lvd_EditStagesGUI>stagesListbox_Callback (line 116)


Error in gui_mainfcn (line 95)


Error in lvd_EditStagesGUI (line 42)


Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)lvd_EditStagesGUI('stagesListbox_Callback',hObject,eventdata,guidata(hObject))

Error using uiwait (line 81)
Error while evaluating UIControl Callback.

Error using isempty
Not enough input arguments.

Error in InitialStateVariable/isVarContainedWithin (line 129)


Error in InitialStateModel/isVarFromInitialState (line 211)


Error in getEventNumberForVar (line 27)


Error in OptimizationVariableSet/isVarEventOptimDisabled (line 200)


Error in OptimizationVariableSet/getTotalScaledXVector (line 43)


Error in LaunchVehicleScript/executeScript (line 235)


Error in ma_LvdMainGUI>propagateScript (line 130)


Error in ma_LvdMainGUI>runScript (line 110)


Error in ma_LvdMainGUI>editLaunchVehicleMenu_Callback (line 455)


Error in gui_mainfcn (line 95)


Error in ma_LvdMainGUI (line 42)


Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_LvdMainGUI('editLaunchVehicleMenu_Callback',hObject,eventdata,guidata(hObject))

Error using waitforallfiguresclosed (line 9)
Error while evaluating Menu Callback.

all I did was open KSPTOT, Open LVD, navigate to the stage editor and try to save & close without even changing anything

Okay, I see what happened. After 10 minutes from this posting, go ahead and redownload the ZIP file above.  That should have the fix in it.

Link to comment
Share on other sites

1 hour ago, Drew Kerman said:

which gives boosters thrust curves that in most cases can exceed 100%

The thrust curves in BetterSRBs are specifically designed so that they average exactly 100%.  So roughly half the time they exceed 100%, and the other half they are below 100%.  By making the mean value equal 100%, maxThurst as specified in the engine configs equals the average thrust.  This allows the in game delta-v readout to correctly compute the burn time.

Link to comment
Share on other sites

ah, geez, @Arrowstar I can't believe I didn't notice this when you posted the screenshot of the new Edit Event window so I could have mentioned this sooner but what happened to the ability to set the integrator output step? Is there still a way I can output data from the GA tool at one-second intervals?

And another request I think I made: Frontal Area output for the GA - just as an easy way to check all drag updates are using the proper values

Edited by Drew Kerman
Link to comment
Share on other sites

9 minutes ago, Drew Kerman said:

ah, geez, @Arrowstar I can't believe I didn't notice this when you posted the screenshot of the new Edit Event window so I could have mentioned this sooner but what happened to the ability to set the integrator output step? Is there still a way I can output data from the GA tool at one-second intervals?

wait, n/m I found it :P

Link to comment
Share on other sites

On 2/29/2020 at 3:11 PM, Drew Kerman said:

oh yea, @Arrowstar there was one feature change I'm not recalling whether you accepted or not - being able to set engine throttle curves to above 100% (max out at 200% should be fine). This is to allow use of

which gives boosters thrust curves that in most cases can exceed 100%

Right now there's a fair bit of engine code that assumes that the throttle range is 0 - 100%.  It would be a fir bit of effort to modify this.  Could you scale the throttles in the code such that the maximum throttle with the booster is 100% and scale the other thrust points appropriately?

On 2/29/2020 at 6:49 PM, Drew Kerman said:

And another request I think I made: Frontal Area output for the GA - just as an easy way to check all drag updates are using the proper values

Yep, I can look into this.  It might be Cd*A though and not just area, but we'll see.

10 hours ago, Gilph said:

Hi @Arrowstar,

The new version of the JNSQ mod implemented a 12 hour Kerbin day. I remember only having a stock kerbin day and an 24 hour earth day available. Is there any way to set a 12 hour day in TOT?

I'm afraid not.  The two time systems are somewhat hard-coded in there, so additional work would be required to add a new time system.

Link to comment
Share on other sites

25 minutes ago, Arrowstar said:

Right now there's a fair bit of engine code that assumes that the throttle range is 0 - 100%.  It would be a fir bit of effort to modify this.  Could you scale the throttles in the code such that the maximum throttle with the booster is 100% and scale the other thrust points appropriately?

That's not a viable option because it will cause other problems.  For instance, the stock delta-v readout computes SRB burn time on the basis of maxThrust as specified in the configs.  The thrust curves are written so that the mean value of the curve is 1, which effectively means that maxThrust = average thrust.  Therefore the delta-v readout correctly computes burn time.  If the curves were written so that the maximum value were 1, then the mean would be <1, resulting in the delta-v readout underestimating the burn time.  This could have bad consequences.  For instance, it could mess up staging sequence if the SRBs burn longer than expected.

So it sounds like having something messed here up may be unavoidable.  No offense, but if I'm going to make it work correctly with something, I'd rather it be the stock delta-v readout.

Link to comment
Share on other sites

@OhioBob, I did not intend to rope you in on this I'm not looking for you to do anything or change anything on your end. Either @Arrowstar makes changes to LVD or I make adjustments on my end

Since this change isn't going to happen soon or maybe not ever, I will adjust things myself to allow compatibility with LVD

Ack, I don't even think I can match the curves anyways since BetterSRBs is using all 4 curve parameters for its thrust curves and LVD's curves are more linear (mass, throttle). So even if I try to just scale down the curve and adjust the thrust value in LVD I can't get it to match the curve BetterSRB has

To be clear, if this can't be worked out I will just go back to using my own thrust profiles - no one has to bend over backwards or anything to get BetterSRB working with LVD

Edited by Drew Kerman
Link to comment
Share on other sites

Good afternoon everyone! 

First of all I love this software! Arrowstar, you are a legend. 

Second, I would love some help with an issue I'm currently running into. I am using KSP to run a small simulation event in the classroom. I teach a space flight course and I would love to have the students open KSPTOT on their computers and see the telemetry update real time as I launch a rocket on my PC. The issue is our University network is set up in such a way that giving out my IP address to each student will not connect to my local computer. I know I could set up a physical local network but that would be a bit of a pain to rearrange the computers and network just for this class. Instead, I was hoping to use something like NGROK to expose my local machine to a public URL. I have some experience with NGROK but I was unable to get KSPTOT to accept an NGROK URL in the RTS connection window. 

NGROK gives a random URL like 123abc45y.ngrok.com - they give this in both HTTP and HTTPS. This URL tunnels directly to my machine and ends up at 127.0.0.1:80 (or whatever port I choose). 

Does anyone know if the RTS in KSPTOT supports a public URL in the RTS connection system? If it does, I'm trying to get the ngrok settings correct so that I have the correct port exposed on the localhost machine running KSP and KSPTOT Connect. 

Thank you all a ton!  Excited to get this working. 

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