Arrowstar / ksptot

KSP Trajectory Optimization Tool
Other
78 stars 13 forks source link

LVD applies changes to throttle/steering models in one event to throttle/steering models in another after loading saved mission #28

Closed EpicSpaceTroll139 closed 2 years ago

EpicSpaceTroll139 commented 2 years ago

I set up a short Tylo lander ascent sequence in LVD involving two constant-thrust burns separated by a coast phase. It has a sequence of 5 events: "Surface Stay," "Liftoff," "Ascent Stage 1 Burn," "Ascent Coast," and "Ascent Stage 2 Burn" as well as a non-sequential event "Switch Steering Model."

The basic idea was that LVD would optimize the linear and accel terms of the steering models and the two constant throttle settings, and the coast duration so as to minimize mass in the Ascent Stage 1 tank while still achieving a certain minimum periapsis constraint at the end. This worked alright last night, with the optimizer finding a way to satisfy the constraints while lowering the tank mass. However, I noticed in pitch graphs that the rocket was doing flips at one point, obviously wasting delta-v. I thought I'd just fix it the next day, so saved it and closed TOT.

When I loaded the mission today, I made some adjustments to the bounds of the linear pitch term on the non-sequential steering event. I then ran the optimizer and noticed that it was optimizing more variables than it should have been. I stopped the optimizer, and started looking through the different events/actions. I noticed that for some reason LVD was now optimizing the steering model and throttle values in the Surface Stay, which should have been fixed constants pointing the rocket up relative to the surface with zero throttle. I fixed this, reran the optimizer, and saw it was now optimizing fewer variables than it should have been. Turned out the steering model values for the Switch Steering Model had been fixed to zero. After several "fixes" I realized changes I applied to steering and throttle in one event were being applied to the other events as well. Deleting events and creating new ones does not seem to solve the problem.
There is an error in the log, however I think this may have simply been me clicking on the wrong close and save button (while a sub-window was still open), as it does not occur at the same frequency I was having the problem. Log and LVD file below: ksptot.log https://drive.google.com/file/d/1AW6WJS8sXmxx6wvop4Ghl_Po_qlAKzyz/view?usp=sharing

Arrowstar commented 2 years ago

Thanks for the report! I wasn't able to reproduce this issue in a new mission, but I do see it in the MAT file you provided. Can you provide clear steps for me to follow so I can reproduce it on my end? Thanks!

EpicSpaceTroll139 commented 2 years ago

I'll work through recreating the mission to see what particular steps caused it. I might have to wait and get back to you on it tomorrow though, since I'm a bit busy. Ironically this was a rebuild of a mission I had to put aside the first save file for because it apparently got broken by an entirely different bug I was expecting to reproduce. Might post that other one tomorrow because I realized that one does have an error message and I think I know what caused it.

Arrowstar commented 2 years ago

Okay great, thank you!

EpicSpaceTroll139 commented 2 years ago

Alright, I haven't reproduced the exact same throttle/steering issue, but instead a slightly more general one which I now realize was already present in the files I shared, and mat have caused the original issue as a symptom.

Step 1: Start a new mission in LVD Step 2: Create a non-sequential event containing one or more variables that are being optimized (termination condition, throttle model, steering, whatever) Step 3: Delete the non-sequential event.

Despite the event having been deleted, the variables that were being optimized still exist according to the optimizer.

Arrowstar commented 2 years ago

Yep, this is a bug! Thanks for finding it. I'll have a new build with the fix uploaded today.

EpicSpaceTroll139 commented 2 years ago

Yep, this is a bug! Thanks for finding it. I'll have a new build with the fix uploaded today.

I actually just found another rather similar bug that appears if you set up a (sequenced) event with the action Set Steering model -> Selectable Model Euler Angles ->Polynomial (for at least one of the angles), save and exit the mission, then reload it. When you reload, the polynomial coefficients/etc still show in the optimizer, but upon opening the steering model, it's been reset to the default Polynomial Model Euler Angles with all terms set to zero, and the same's happened for any other throttle/steering/whatever models in the mission. Might be a more general way to trigger it, but that way definitely does.

It's so similar, I wonder if whatever you did to fix the other issue will fix this. If not, I can put this in its own issue thread.

Arrowstar commented 2 years ago

Thanks for the new steps! In the mean time there's a new build up. Can you go ahead and test on that one and tell me if the issue persists?

EpicSpaceTroll139 commented 2 years ago

Thanks for the new steps! In the mean time there's a new build up. Can you go ahead and test on that one and tell me if the issue persists?

Just downloaded it. Starting up right now, will let you know how it goes

Arrowstar commented 2 years ago

I actually just found another rather similar bug that appears if you set up a (sequenced) event with the action Set Steering model -> Selectable Model Euler Angles ->Polynomial (for at least one of the angles), save and exit the mission, then reload it. When you reload, the polynomial coefficients/etc still show in the optimizer, but upon opening the steering model, it's been reset to the default Polynomial Model Euler Angles with all terms set to zero, and the same's happened for any other throttle/steering/whatever models in the mission.

I'm still seeing this, so I'll continue to investigate. Thank you for this new report!

EpicSpaceTroll139 commented 2 years ago

I actually just found another rather similar bug that appears if you set up a (sequenced) event with the action Set Steering model -> Selectable Model Euler Angles ->Polynomial (for at least one of the angles), save and exit the mission, then reload it. When you reload, the polynomial coefficients/etc still show in the optimizer, but upon opening the steering model, it's been reset to the default Polynomial Model Euler Angles with all terms set to zero, and the same's happened for any other throttle/steering/whatever models in the mission.

I'm still seeing this, so I'll continue to investigate. Thank you for this new report!

Yep, I can confirm it's still there, but the bug with the variables still existing after a non-sequenced event is removed is gone! :)

Arrowstar commented 2 years ago

I actually just found another rather similar bug that appears if you set up a (sequenced) event with the action Set Steering model -> Selectable Model Euler Angles ->Polynomial (for at least one of the angles), save and exit the mission, then reload it. When you reload, the polynomial coefficients/etc still show in the optimizer, but upon opening the steering model, it's been reset to the default Polynomial Model Euler Angles with all terms set to zero, and the same's happened for any other throttle/steering/whatever models in the mission.

I'm still seeing this, so I'll continue to investigate. Thank you for this new report!

Yep, I can confirm it's still there, but the bug with the variables still existing after a non-sequenced event is removed is gone! :)

Copy that, I think I've got it figured out. I'll have a new build put together tonight.

Arrowstar commented 2 years ago

Okay, go ahead and try the release I uploaded tonight and let me know if the issue with the steering and throttle modes on load is resolved.

EpicSpaceTroll139 commented 2 years ago

Okay, go ahead and try the release I uploaded tonight and let me know if the issue with the steering and throttle modes on load is resolved.

It would appear that the issue is fixed. Thank you!

Arrowstar commented 2 years ago

Great! Thank you for the help!

EpicSpaceTroll139 commented 1 year ago

Thanks!

I'll check it out when I get home.

On Sat, Jun 11, 2022, 8:02 PM Arrowstar @.***> wrote:

Okay, go ahead and try the release I uploaded tonight and let me know if the issue with the steering and throttle modes on load is resolved.

— Reply to this email directly, view it on GitHub https://github.com/Arrowstar/ksptot/issues/28#issuecomment-1153023968, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRMIYFU3HIFX3BC2KN26ZDVOUSJBANCNFSM5YLMN7MA . You are receiving this because you authored the thread.Message ID: @.***>