TwinActivate ConditionalSelect 'Copy first input if' choice.

HengJiaYe
HengJiaYe Altair Community Member
image.png

If 

u2 == true

 is selected, does 

true

 contain negative values? Or is there any block of code that can detect the presence of a signal and then output the corresponding value?

Tagged:

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • GTT Adam
    GTT Adam
    Altair Employee

    Hi @HengJiaYe,

    The u2==true condition will only copy the first input if it is equal to the switch threshold. Threshold values can be negative.

    In this simple model, my threshold is -10. As you can see, u2==true, and thus the value of 1 is passed through the ConditionalSelect block:

    image.png

    Hope this helps!

    Adam Reid

  • Orestis_YB
    Orestis_YB
    Altair Employee

    Hello @HengJiaYe ,

    when you are using the u2==true condition then for any input u2 value except 0 you'll get u1 as output. If you want to actually use the threshold value a then you should use one of the other conditions. In the model below I have an input starting from -15 and increasing till 15. I added a 5s window where the value is zero. The threshold a value is set to -10 but it's not considered in this case. The output value equals u3 only when u2 equals 0 (FALSE)

    image.png

    Math expression block offers more flexibility when your comparative expression becomes more complex.
    Here is an example where 3 inputs are used (u1, u2 and u3). u2 is used as the condition select and the output is the sum of the expression.

    image.png

    The above expression works like this.

    IF u2>0 & u2<10:
    y = u1
    ELSEIF u2=<0
    y = u3
    ELSE
    y = 0
    END

    Hope this helps!

    Best regards,
    Orestes

  • HengJiaYe
    HengJiaYe Altair Community Member

    Thanks for your reply—it helped me realize that negative numbers are also treated as true.

    Have a nice day!

  • HengJiaYe
    HengJiaYe Altair Community Member

    Thanks for sharing both examples! They really clarified the full-range check—especially the one that used a math trick I completely forgot about (haha).

    Have a nice day!

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.