Jump to content

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


Recommended Posts

20 hours ago, KC_073 said:

Quick bug report - if I enable optimization for RAAN in the initial states in MA, the optimizer hangs on the "Please wait while the optimizer initializes..." popup and I get an error ding from windows.  Clicking X on the popup lets me return to the MA windows.

I could not reproduce.  Please provide a MAT file that shows the problem.  Thanks!

Quote

Another which might be a misunderstanding on my part - putting  a number into Arg.Peri. in the initial states  "edit state" pane and then saving will add it to the true anom. field and reset the Arg.Peri. to 0.  Not 100% an expert on orbital mechanics so this could easily be me not knowing what I'm doing.

What's happening here is that your orbit is circular and so it has no periapsis.  The code falls back to a special "circular orbit" method for displaying orbital elements where argument of periapsis is 0.0 and any angle in that field goes to true anomaly (which is technically called something else in this case if you want to be academic about it).  Argument of periapsis is not defined for circular orbits, hence this methodology.

Quote

Finally, a request - for parallel workers, let us set the number to start. My issue is that I'm running on a 3900x, and starting up 24 parallel workers takes a good bit of time and memory.  I imagine that's well down on the diminishing returns curve, so starting 8 or so might be just as good and not take nearly as long?

Yes, I can add this to LVD.  I'll try to do it with MA too if I can.

Link to comment
Share on other sites

18 minutes ago, Arrowstar said:

I could not reproduce.  Please provide a MAT file that shows the problem.  Thanks!

What's happening here is that your orbit is circular and so it has no periapsis.  The code falls back to a special "circular orbit" method for displaying orbital elements where argument of periapsis is 0.0 and any angle in that field goes to true anomaly (which is technically called something else in this case if you want to be academic about it).  Argument of periapsis is not defined for circular orbits, hence this methodology.

Yes, I can add this to LVD.  I'll try to do it with MA too if I can.

MA file for the RAAN problem - http://www.mediafire.com/file/y3bmpcs3bh5zia9/file

For me a simple ctrl+R shows the problem, as does ctrl+O then optimize.

 

Another one I just found, this time an example of "Subscript indices must either be real positive integers or logicals."

MA file - http://www.mediafire.com/file/fo4y7zf50rnzm8y/file

log - http://www.mediafire.com/file/yddjsu077083htu/file

For either of these, it could be that I'm doing something wrong so appreciate you taking a look.

 

And thanks for the explanation about the Arg.Pe. question. Makes perfect sense.

 

 

Link to comment
Share on other sites

3 hours ago, KC_073 said:

MA file for the RAAN problem - http://www.mediafire.com/file/y3bmpcs3bh5zia9/file

For me a simple ctrl+R shows the problem, as does ctrl+O then optimize.

Resolved for next release.

Quote

Another one I just found, this time an example of "Subscript indices must either be real positive integers or logicals."

MA file - http://www.mediafire.com/file/fo4y7zf50rnzm8y/file

log - http://www.mediafire.com/file/yddjsu077083htu/file

For either of these, it could be that I'm doing something wrong so appreciate you taking a look.

I couldn't reproduce this one.  What did you do to cause it to occur?

Link to comment
Share on other sites

7 minutes ago, Arrowstar said:

I couldn't reproduce this one.  What did you do to cause it to occur?

hmm, weird.  For my setup, I just loaded the file and hit control-R.  After a step or two it gave the error.  Let me know if there's anything other info I can grab to help repro it.

Link to comment
Share on other sites

8 minutes ago, KC_073 said:

hmm, weird.  For my setup, I just loaded the file and hit control-R.  After a step or two it gave the error.  Let me know if there's anything other info I can grab to help repro it.

Reproduced it here on 1.6.7 PR3 too (Linux version).

Link to comment
Share on other sites

On 8/24/2020 at 12:48 PM, KC_073 said:

Finally, a request - for parallel workers, let us set the number to start. My issue is that I'm running on a 3900x, and starting up 24 parallel workers takes a good bit of time and memory.  I imagine that's well down on the diminishing returns curve, so starting 8 or so might be just as good and not take nearly as long?

Resolved for both MA and LVD in next release.  The default is still the number of cores in the system, but you can change it now.

On 8/24/2020 at 12:31 PM, Drew Kerman said:

I can do a more basic test with a LF/O engine, just launch it straight up at full thrust. Only have the data above right now as I'm working on a flight analysis to publish tomorrow so won't be able to do the simpler test until later this week, maybe weekend. Let me know what else you'd like me to do

Can you provide me universal time, altitude, latitude, longitude, pressure, temperature, and density for this "more basic" test?  A Google sheets doc would be fine for now.  Thank you! :)

Edited by Arrowstar
Link to comment
Share on other sites

32 minutes ago, KC_073 said:

hmm, weird.  For my setup, I just loaded the file and hit control-R.  After a step or two it gave the error.  Let me know if there's anything other info I can grab to help repro it.

How long does a single iteration take?  It seems like it takes forever on my system, I never get past iteration 0.

Link to comment
Share on other sites

1 minute ago, Arrowstar said:

How long does a single iteration take?  It seems like it takes forever on my system, I never get past iteration 0.

For me it is maybe 5 seconds?

From the output window -
 

(15:11:50) Beginning mission script optimization...                                          
(15:11:54) Iteration    Fcn-Count    f(x)-Value   Feasibility  Optimality   Norm. Step       
(15:11:54)   0            8            8.31191e+07  3.54e+15    NaN          NaN         

 

Link to comment
Share on other sites

31 minutes ago, KC_073 said:

For me it is maybe 5 seconds?

From the output window -
 


(15:11:50) Beginning mission script optimization...                                          
(15:11:54) Iteration    Fcn-Count    f(x)-Value   Feasibility  Optimality   Norm. Step       
(15:11:54)   0            8            8.31191e+07  3.54e+15    NaN          NaN         

 

Strange, I still can't get it to optimize.  I know what's causing the issue, though, so I have put in a fix that will hopefully work around the issue.

Link to comment
Share on other sites

4 hours ago, Arrowstar said:

Can you provide me universal time, altitude, latitude, longitude, pressure, temperature, and density for this "more basic" test?  A Google sheets doc would be fine for now.  Thank you! :)

no problem - just to confirm straight up is good? Or would an angle be better?

Link to comment
Share on other sites

I'm a bit confused on the difference between launch vehicle designer and MA. Could someone clarify?

Is it possible to use the KSPTOT to plan the optimum launch time for an orbital rendezvous?

Edited by dlrk
Link to comment
Share on other sites

18 minutes ago, dlrk said:

I'm a bit confused on the difference between launch vehicle designer and MA. Could someone clarify?

Off the cuff ...

Launch vehicle design is about the launch vehicle itself & getting the payload to where you want it to go.

Mission architecture is about the payload & mission specs. How do you get it there? (Think encounters and transfers) What do you wanted to do once the payload arrives on station.

Edited by TranceaddicT
Link to comment
Share on other sites

1 hour ago, dlrk said:

So, I'm trying to use KSPTOT to work out when to launch to rendezvous directly with a station over Kerbin

 

Unless there is a way to import orbit info in for a satellite or station, I don't think this is for that.

Easiest way to get rendezvous is wait until the station orbit crosses over (or near) your launch site.  Then, launch toward the requisite inclination.  After that, it's just a little fine-tuning of the orbit to make rendezvous.

Link to comment
Share on other sites

@Arrowstar I'm getting this error when trying to run the script on the LVD (1.6.7 PR3):

Error using /
Matrix dimensions must agree.

Error in LaunchVehicleStateLogEntry.getTankMassFlowRatesDueToEngines (line 540)


Error in ThrustForceModel/getForce (line 19)


Error in TotalForceModel.getForce (line 25)


Error in ForceModelPropagator/odefun (line 158)


Error in ForceModelPropagator>@(t,y)ForceModelPropagator.odefun(t,y,eventInitStateLogEntry,tankStates,dryMass,pwrStorageStates,obj.forceModels) (line 57)


Error in odearguments (line 90)


Error in ode45 (line 115)


Error in ODE45Integrator/integrate (line 23)


Error in ForceModelPropagator/propagate (line 49)


Error in LaunchVehicleSimulationDriver/integrateOneEvent (line 171)


Error in LaunchVehicleEvent/executeEvent (line 159)


Error in LaunchVehicleScript/executeScript (line 293)


Error in ma_LvdMainGUI>propagateScript (line 173)


Error in ma_LvdMainGUI>runScriptMenu_Callback (line 1608)


Error in gui_mainfcn (line 95)


Error in ma_LvdMainGUI (line 42)


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

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

 

Only stuff a bit different from the tutorials, so far is that I'm using solid fuel boosters, and I have both engines from first and second stages active at the same time.

EDIT: Looks like the problem is related to the new engine alternator stuff. Deactivating it from the engines make the simulation work

Could you take a look when you get some time? Here's the .mat -> https://www.dropbox.com/s/el7rtf86csxw7cj/LVD-Direct_ascent_to_duna3.mat?dl=0

Edited by vitorboschi
Link to comment
Share on other sites

8 hours ago, dlrk said:

I'm a bit confused on the difference between launch vehicle designer and MA. Could someone clarify?

I'll leave this to Arrowstar to comment on, because the development history is clearer in his mind - but it's an understandable confusion without knowing how these two aspects of KSPTOT evolved

8 hours ago, dlrk said:

Is it possible to use the KSPTOT to plan the optimum launch time for an orbital rendezvous?

This one is easy - in LVD open the lvdExample_TwoStageToOrbit.mat file. It is exactly what you want

Link to comment
Share on other sites

3 hours ago, Drew Kerman said:

This one is easy - in LVD open the lvdExample_TwoStageToOrbit.mat file. It is exactly what you want

Could I get some more information on how this works? To be honest, I'm not really getting how this works at all, I can see it's a detailed trajectory plan for a launch and rendezvous, but I don't see what information is given to get the launch time or where the launch time is given.

Link to comment
Share on other sites

12 hours ago, dlrk said:

I'm a bit confused on the difference between launch vehicle designer and MA. Could someone clarify?

Is it possible to use the KSPTOT to plan the optimum launch time for an orbital rendezvous?

Yeah, it's a good question and I realize it's a confusing point given the names.  Basically, Mission Architect started out as an end-all be-all general spaceflight mission design tool for KSP, and it remains that today.  Originally, LVD was going to be a component of MA that focused strictly on launch vehicle design: so it would model stages, fuel tanks, realistic engines, etc.  What I found when I was developing it, though, is that the way I set up LVD was much more flexible than the old way of designing missions in MA.  Since then I've been gradually adding functionality to LVD and at this point I almost consider LVD to be a full successor to MA.  LVD can do just about everything MA can (aside from some of the "other spacecraft" stuff and communications network modeling), but it does it better, is more organized, and (I hope) smoother for the analyst to use.

Going forward, I consider MA feature complete and while I'll certainly support it and fix bugs for it, I don't anticipate adding new things.  My recommendation would be to use LVD going forward for all of your mission design needs, even those not requiring launch vehicles directly.  There's just so much more LVD can do, even in generic spacecraft missions, that the choice seems pretty clear to me today. :)

Link to comment
Share on other sites

32 minutes ago, dlrk said:

Could I get some more information on how this works? To be honest, I'm not really getting how this works at all, I can see it's a detailed trajectory plan for a launch and rendezvous, but I don't see what information is given to get the launch time or where the launch time is given.

lol my bad I meant it was easy for me to answer :P you'll actually want to start with the Launch Window Analysis tool in MA. Actually that's probably something @Arrowstar will want to port over to LVD as well

Link to comment
Share on other sites

Launch Window Analysis looks like what I want, thank you very much. Is it possible to get the launch window day/month/year/time, versus seconds from epoch? Could I get some information on how to use the Estimate Launch in MA/LVD? Is the time of flight/long/lat just something to derive from how I plan to fly the vehicle?

Also, the set launch site coordinates from ground target button on estimate launch doesn't work. Nothing happens when it clicks.

Could a get orbit function be added to Launch Window Analysis, by the way?

Thanks very much for the help, @Drew Kerman @Arrowstar

Edited by dlrk
Link to comment
Share on other sites

8 hours ago, vitorboschi said:

@Arrowstar I'm getting this error when trying to run the script on the LVD (1.6.7 PR3):


Error using /
Matrix dimensions must agree.

Error in LaunchVehicleStateLogEntry.getTankMassFlowRatesDueToEngines (line 540)


Error in ThrustForceModel/getForce (line 19)


Error in TotalForceModel.getForce (line 25)


Error in ForceModelPropagator/odefun (line 158)


Error in ForceModelPropagator>@(t,y)ForceModelPropagator.odefun(t,y,eventInitStateLogEntry,tankStates,dryMass,pwrStorageStates,obj.forceModels) (line 57)


Error in odearguments (line 90)


Error in ode45 (line 115)


Error in ODE45Integrator/integrate (line 23)


Error in ForceModelPropagator/propagate (line 49)


Error in LaunchVehicleSimulationDriver/integrateOneEvent (line 171)


Error in LaunchVehicleEvent/executeEvent (line 159)


Error in LaunchVehicleScript/executeScript (line 293)


Error in ma_LvdMainGUI>propagateScript (line 173)


Error in ma_LvdMainGUI>runScriptMenu_Callback (line 1608)


Error in gui_mainfcn (line 95)


Error in ma_LvdMainGUI (line 42)


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

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

 

Only stuff a bit different from the tutorials, so far is that I'm using solid fuel boosters, and I have both engines from first and second stages active at the same time.

EDIT: Looks like the problem is related to the new engine alternator stuff. Deactivating it from the engines make the simulation work

Could you take a look when you get some time? Here's the .mat -> https://www.dropbox.com/s/el7rtf86csxw7cj/LVD-Direct_ascent_to_duna3.mat?dl=0

Found it.  Issue resolved for next release.

Link to comment
Share on other sites

1 hour ago, dlrk said:

 Is it possible to get the launch window day/month/year/time, versus seconds from epoch? Could I get some information on how to use the Estimate Launch in MA/LVD? Is the time of flight/long/lat just something to derive from how I plan to fly the vehicle?

  1. It's not directly, but there are all sorts of places in KSPTOT where you can enter UT and get out the date.  It's generally more useful to output the UT with KSPTOT because that's the authoritative number within KSPTOT, not the date string.
  2. Basically it just draws an ellipse between your launch site and your orbit insertion site, and then maps that ellipse to a spherical space instead of a Cartesian space.  It's pretty crude and doesn't work all that well if you care about the launch at all, but if all you're after is some info about where you'll be in space when you separate your spacecraft from the launcher, it'll work fine.
  3. Yes, exactly.  You'll need to know something about how your rocket flies with its payload in order to get those parameters.
Quote

Also, the set launch site coordinates from ground target button on estimate launch doesn't work. Nothing happens when it clicks.

Yeah, so this is embarrassing.  The reason nothing happens is because there's literally no code in that menu's callback function.  Whoops.  Looks like something I wanted to do and then forgot about lol.  I'll add it back in.  Good find, btw.  That's probably been like that for years and no one has either noticed or said anything.

EDIT: And now it does something.  Easy fix. :)

Quote

Could a get orbit function be added to Launch Window Analysis, by the way?

Yeah I could do that probably.  Let me look into it.

EDIT: Added for next release.

Edited by Arrowstar
Link to comment
Share on other sites

Thanks very much. Guessing launch window analysis will wind up added to LVD? If you don't mind, I'm curious how LWA works without knowing the the launch vehicle performance.

Edited by dlrk
Link to comment
Share on other sites

17 minutes ago, dlrk said:

Thanks very much. Guessing launch window analysis will wind up added to LVD? If you don't mind, I'm curious how LWA works without knowing the the launch vehicle performance.

Basically it assumes a "fast" launch (so instantaneous") and then determines when the orbit plane, defined by inclination and RAAN, intersects the launch site.  That's your launch time.  Azimuth is computed by spherical trig, basically.

And yes, if there's interest, I imagine I could add LWA to LVD.

Link to comment
Share on other sites

3 minutes ago, Arrowstar said:

And yes, if there's interest, I imagine I could add LWA to LVD.

I'd say only do it if there's ability in LVD's better structure to improve on it in a substantial way. Otherwise opening up MA to use it isn't really that big of a deal. On the other hand, that's not where people would think to look for it either

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