An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
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?
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:
Hope this helps!
Adam Reid
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)
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.
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
Thanks for your reply—it helped me realize that negative numbers are also treated as true.
Have a nice day!
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).