ferram4 / Ferram-Aerospace-Research

Aerodynamics model for Kerbal Space Program
Other
239 stars 131 forks source link

Odd wing shielding and stalling behaviour #90

Closed mjn33 closed 9 years ago

mjn33 commented 9 years ago

While testing some very old FAR craft I found some wings seemed almost permanently stalled. Adding some extra information to the right click menu, it seems that often there was asymmetric shielding, and that AoAmax for the stalling wing pieces could range from anything between ±40000 as a lower bound.

To verify this wasn't something weird lurking in the old craft files I based two new test craft of off the old "FAR Hypersonic Demon".

FARtest12.craft (no shielded wings, needs infinite fuel enabled) FARtest13.craft (shielded wings)

Also, I found that actions such as deploying and retracting landing gear somehow affect the shielding of a wing piece completely separate from it.

I'd guess the odd stalling behaviour is related to the wing interaction code, as I couldn't see anything in there that differentiates between part of an actual wing, or a wing piece used as a structural piece.

Reproduction steps:

  1. (Optionally) add some extra info to the right click GUI (see Gist)
  2. Go to the SPH
  3. Load the FARtest13 craft
  4. Launch
  5. Gain some speed
  6. Observe that some wing pieces are almost permanently stalled / other weirdness

https://gist.github.com/mjn33/43d9f7bf048be8746533 (also contains a few experiments relating to shielding) screenshot0.png screenshot1.png screenshot2.png Player.log (don't think there's anything useful in there)

ferram4 commented 9 years ago

Alright, one possible issue is that the AoAmax can vary based on what order parts are calculated in due to using a single variable for the AoAmax after all the interactions and for before. So I added a rawAoAmax to handle the pre-interaction value that the interactions will work with. Another was a similar possibility with liftslope, so same change there.

That should fix it, I think.

mjn33 commented 9 years ago

Doesn't seem to have fixed it. I think what's happening is FARWingInteraction is handling wing pieces with isShielded == true, for those wing modules garbage values are being used (e.g. default rawAoAmax = 15, which is ~859°). Shouldn't the wing interaction code ignore wing modules with isShielded == true?

Version of the "FAR Hypersonic Demon" tested on: FAR Hypersonic Demon2.craft

ferram4 commented 9 years ago

Well, I added code to handle that, but I don't see how only handling positive numbers and being limited to linearly changing between two positive numbers could ever lead to the behavior shown.

mjn33 commented 9 years ago

If I were to guess how AoAmax became negative, probably around FARWingAerodynamicModel.cs#L761 with effectiveUpstreamInfluence > 1. Regardless, the isShielded check fixes the stalling issue.

Reproduction steps for demonstrating the wing shielding issues:

  1. Build FAR with some extra debugging info (this patch)
  2. Go to SPH and launch the the test craft FAR Hypersonic Demon2.craft
  3. Brakes on
  4. Using the right click menu to observe the state of the wing shielding
  5. Try toggling landing gear and observe how the values change

An example of the asymmetric shielding issue: screenshot3.png screenshot4.png Retracting and then redeploying the landing gear resulted in a different outcome (now both wings are shielded somehow): screenshot5.png screenshot6.png

ferram4 commented 9 years ago

Alright, I believe I have fixed it.

Also good to see that the Hypersonic Demon is still a terrible beast. Nice sideslip and destruction at Mach 3 at 2 km.

mjn33 commented 9 years ago

Tested, works brilliantly! Closing as fixed.

Aerostructural failures is one of those things I love in a weird way...