Rapid-Design-of-Systems-Laboratory / beluga

General purpose indirect trajectory optimization
Other
25 stars 6 forks source link

Add Goddard Rocket example #180

Closed SeanMatthewNolan closed 5 years ago

SeanMatthewNolan commented 5 years ago

Not really an issue, but I like referencing something.

msparapa commented 5 years ago

I actually think I just solved this problem. Or rather the reverse of the problem. See 9-moonlander. You should still implement your solution with epsilon-trig because I used UTM + ICRM.

SeanMatthewNolan commented 5 years ago

That's a good problem and solution. The problem is pretty similar, but somewhat different from the Goddard rocket.

SeanMatthewNolan commented 5 years ago

@msparapa We can easily use this example as a comparison to pseudospectral methods. We obtain a higher quality solution in a fraction of the time.

msparapa commented 5 years ago

Best comparison right now would be against opengoddard's solution. Pseudospectral still uses my slow npnlp package.

SeanMatthewNolan commented 5 years ago

That was the comparison I was talking about

msparapa commented 5 years ago

Between time 0.025 and 0.075, is the control on a singular arc? I'm not too certain what's going on here. Making epsilon not so small kind of reveals a bit more about what the control is doing.

SeanMatthewNolan commented 5 years ago

Oh, I was adding the plots last night. I just didn't get a chance to push them. In this case, the control should be bang-bang. As epsilon goes to 0, it mathematically will converge to the original problem.

msparapa commented 5 years ago

BOCOP seems to think that, unconstrained (black line in plot below), there's a singular arc between 0.025 and 0.075. With really small epsilon for us, it appears as if the thrust is off between 0.025 and 0.075, but velocity is increasing albeit increasing slower than <0.025.

Looking at opengoddard's solution, it sorta resolved this same shape as well, but not nearly as smooth.

control

SeanMatthewNolan commented 5 years ago

That problem has a dynamic pressure constraint. I was actually going to add that as a variation in that folder. It's described in this article: https://arc-aiaa-org.ezproxy.lib.purdue.edu/doi/pdf/10.2514/3.21080

SeanMatthewNolan commented 5 years ago

As long as the problem solves, the epsilon should be as small as possible.

msparapa commented 5 years ago

It's not active though with their C=0.8. I tried with drag max = 0.5 and here's what I got. Thrust is essentially off but we're still gaining velocity and losing mass. Making epsilon, not so small, changest the thrust history a lot and I can sort of see the curve from BOCOP's solution, but velocity and mass don't change.

epsilon = 0.001

thrust mass constrained

msparapa commented 5 years ago

And here's eps = 0.005. The other plots are pretty much identical.

thrust2

SeanMatthewNolan commented 5 years ago

Check the final altitude. See which is optimal.

msparapa commented 5 years ago

Same for both. The velocity is integrated correctly but I don't think it's representing the singular arc correctly. Changing epsilon also changes thrust, but not velocity. I honestly have no idea where the problem is.

SeanMatthewNolan commented 5 years ago

No, it isn't. There shouldn't be a singular arc here. If they show a singular arc, it's either a difference in the numbers or they are incorrect. With epsilon as low as possible, a greater altitude is achieved. The difference isn't large because everything is normalized by the radius of the Earth, but the difference is there. Mathematically, epsilon being smaller will approach the original problem and result in a lower cost. I think if the problem is posed without the normalization, it would show the difference even clearer. Altitude vs Epsilon

msparapa commented 5 years ago

Maybe I'm not understanding the problem. Why does velocity increase between 0.025 and 0.075 if thrust is off?

t-v

msparapa commented 5 years ago

I figured it out. It's our old friend scaling. Running with autoscale=False gives more reasonable answers for thrust, save for the singular arc.

SeanMatthewNolan commented 5 years ago

I was going to say, that the problem wouldn't be the epsilon. It had to be something else.

msparapa commented 5 years ago

Pretty confident this is a larger issue dealing with scaling, maybe even the math behind epsilon-trig. I think the issues here are the same that are preventing me from solving constrained hypersonic problems. Otherwise Goddard seems to be working fine. Should we close this and make a new issue to fix this?

SeanMatthewNolan commented 5 years ago

The scaling should be turned off in that the problem is already scaled. I was going to add some sub problems, but that is so low on my list that I'll close this now.