Profile image

Realistic Turn Performance - AoA and G Limiter with PID Controller

907 moistcottonbud  3.5 years ago

Hello there,

Airplanes that look good are prioritized than the ones that behave like airplanes. Nonetheless if you are tired of your airplane pulling 35Gs but don't know what to do about it here's a solution.

You can put the statement below in the input section of your stabilizers (or whatever surface you use for Pitch) and it should work.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

TAS / pow(1.4 * 287 * (273 + (20 - (Altitude/1000)*6.5 ) ), 0.5) < 0.6 ? PID(Pitch,-AngleOfAttack/18,0.5,0,0.06) : PID(Pitch,-(VerticalG-1)/6.33,0.2,0.8,0.06)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

It is a set of PD and PID controllers. If M < 0.6 then it goes to AngleOfAttack limiter of 18degs, if M > 0.6 then it goes to the G limiter of 7.33Gs

If you want to edit the parameters feel free, you can spot the Mach, AoA and G parameters as 0.6, 18 and 6.33 respectively. For the G limit put whatever you want minus one. So for this case, 6.33 corresponds to 7.33Gs.

This doesn't require any mods, you just need to edit in XML do a simple copy/paste.

For seeing how your aircraft is operating the simplest thing is to open the console commands and type in:

DebugExpression "-AngleOfAttack"
DebugExpression "VerticalG"

One known problem is that the transition between the AoA and G Limiter is not smooth so at M=0.6 (or whatever Mach number you want to switch the controller) you will get a short pitch change but it isn't anything game breaking.

Also I set the AoA limit quite relaxed so if you jinx the controller the AoA might go to 23 degrees or so but will settle at 18, so it overshoots. The G Limiter acts like butter thanks to the integral component.

Tag me if you use this in any of your design, I'm always curious about realistic handlnig aircraft!

  • Log in to leave a comment
  • Profile image

    Update:
    I applied the code as is to my horizontal stabilizers, and the control surfaces froze sometime during takeoff.
    One was frozen down and the other frozen up.
    So I kept rolling and lost control...

    Any fix to this?

    5 months ago
  • Profile image

    I'm currently working on an F-15 style aircraft.
    It pulled like 8-12 Gs at subsonic speeds but as soon as it went to mach 1 it pulled 35 and its turn speed doubled.

    I'll give an update on how the limiters effect my Manuverability and if I need to edit my wings ;-;

    5 months ago
  • Profile image
    60 GLAPS

    Hey, I put this into one of my aircraft, and when reaching the speed required to get the G limiter to kick in (whatever speed it's set to), it shakes up and down violently. Kind of reminds me of the AI trying to fly in a straight line. At speeds high enough the aircraft loses all pitch control and the shaking gets it up to some insane Gs. I might be an idiot, and didn't see something in the post, but let me know if you have any fixes. Cheers!

    +2 11 months ago
  • Profile image

    @Birdperson only this part: PID(Pitch,-(VerticalG-1)/6.33,0.2,0.8,0.06)

    +2 1.2 years ago
  • Profile image

    How would I remove the aoa limiter and just have the g limiter?

    1.3 years ago
  • Profile image
    7,616 TrueNoMan

    @moistcottonbud oh thx

    +1 1.9 years ago
  • Profile image

    @TrueNoMan normally you already have a G of 1 because of earths gravitational field. Negative 1 accounts for that and makes the gravity component zero when you are not accelerating

    +1 2.0 years ago
  • Profile image
    7,616 TrueNoMan

    @moistcottonbud Might you explain why, in the expression, both the current VerticalG and the G-force upper limit are the actual value minus 1?

    +1 2.0 years ago
  • Profile image

    Thx a lot

    2.3 years ago
  • Profile image
    23.8k JuanNotAnAlt

    @moistcottonbud I need help with g limiter :P

    +1 2.6 years ago
  • Profile image

    @Rakoval500k yup it should be possible i was very new to funky when i did this. If i were to do it now i would definitely do it something like x(Glimiter) + (1-x)(AoAlimiter) with x being TAS or something similar. This way you would always have both in effect. Unfortunately I dont have the time now to work on this, but tag me and I will take a look. Cheers

    +1 2.9 years ago
  • Profile image
    1,876 Rakoval500k

    Greetings! Is it possible to make both limiters work simultaneously and with equal authority?
    I mean, i'd like to see an AoA limiter that starts working at TAS/IAS of 2-5(Because at zero speed AoA is defined randomly), or/and may be de/activated through AG, while the G-limiter is constantly engaged. I'll post my test-bed aircraft in unlisted for testing it and tag you, if you answer positively.

    +1 2.9 years ago
  • Profile image

    Idk why but it isnt working for me, its because im using low physics?

    +2 3.0 years ago
  • Profile image
    82 invaled

    My question is how do I limit the PID output value? It must be from -1 to 1 (or 0 to 1 for Throttle). I tried clamp01, but the PID control still going above 1 and under 0

    3.0 years ago
  • Profile image
    37.0k Ruvie

    @moistcottonbud ah, i see...
    thanks a lot!

    +1 3.5 years ago
  • Profile image

    @RuvienRuvienTheCitizen It is automatically simulated due to the G limit. If you search "F16 em chart" on google you will see that after some Mach number turn rate is bounded by the G limit. That is your stiffening, the pilot can pull max 9Gs doesn't matter if you are going 500 kts or 1500 kts which in turn affects the turn rate. For velocities where you can't reach the G limit in an instantaneous turn, the performance is limited by aerodynamics and that is the AoA limit. If you again look in the em chart, you will see that top curve on the graph, inst. turn rate increases, then decreases. That is the switch between aerodynamics limitation and structural limitation. I hope that answers your question.

    +1 3.5 years ago
  • Profile image
    37.0k Ruvie

    Um, just a question.
    how do you simulate aerodynamic stiffening ?

    +1 3.5 years ago
  • Profile image

    this is underrated

    +1 3.5 years ago