Profile image

Three diferent booleans in single FT equation possible?

8,647 NAD  7 months ago

Hi there,

This is my current FT for an engine:

TAS>1000 | Altitude>10000 ? clamp(smooth(Throttle, 0.01), 0, 0.4) : smooth(Throttle, 0.01)

But i'd like to add this FT boolean too to the engine input:

Throttle=0 ? Throttle : smooth(Throttle, 0.01)

How can i add the top two booleans and adding this last one for an all in one?

  • Log in to leave a comment
  • Profile image
    35.3k SnoWFLakE0s

    @nadvgia
    .
    Glad to help.

    7 months ago
  • Profile image
    8,647 NAD

    @SnoWFLakE0s It helped a lot, it works 100% as pretended. and i learned something new today in FT, many thanks for enlighten me.

    Best Regards!

    7 months ago
  • Profile image
    35.3k SnoWFLakE0s

    @nadvgia
    .
    So the idea is that if Throttle = 0, you want the whole expression to evaluate to 0 regardless, correct? This can be done using simpler math, no need for logic operators. Add this to your original expression in the form of a factor: ceil(Throttle)


    That is, your final expression should look like


    ceil(Throttle) * ((TAS>1000 | Altitude>10000) ? clamp(smooth(Throttle, 0.01), 0, 0.4) : smooth(Throttle, 0.01))


    Hope this helped.

    7 months ago
  • Profile image
    8,647 NAD

    @SnoWFLakE0s I´ll explain what i pretend.


    TAS>1000 | Altitude>10000 ? clamp(smooth(Throttle, 0.01), 0, 0.4) : smooth(Throttle, 0.01)


    My idea here is giving limits to the aircraft height and speed, and when the aircraft can't find those limits, it smooth its speed up and down regarding the throttle value. This works as pretended, when those limits are true, it clamps the throttle from 0 to 0.4 to force the engine to low its speed rate.


    The problem is, when throttle down to a value of 0 when in a certain speed, it still follows the smooth and goes back to its value.

    So i came with an idea to go around that issue:


    Throttle=0 ? Throttle : smooth(Throttle, 0.01)


    When the value is 0, the true statement is Throttle without any smooth value, so the engine will stop with no delay. If higher than 0, the smooth value remains.

    Regarding grouping syntax, i do not know the "flawless" way to write FT. All i do is trial and error so when i have sucess i can learn from it.

    7 months ago
  • Profile image
    35.3k SnoWFLakE0s

    First of all, syntax... Order of operations for logic operators exist, but I would not rely on it. Group your statements.

    I also aren't so sure about what you're trying to do with the second statement. It doesn't make sense... Have the statement evaluate to Throttle when it's equal to 0? Seems like an odd choice to me.

    Anyhow, if you could possibly explain what you mean by combining the expressions, I could help... I don't quite follow right now.

    7 months ago
  • Profile image
    8,647 NAD

    @SnoWFLakE0s

    7 months ago