"IF" function

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by gingergine on Wed, 02/10/2010 - 12:59 

 

Does VisSim have an 'IF' function? I have tried with the Boolean's <= but it only yields a 0 if false. I am trying to create a function such that 'IF y less than or equals to 3, y = 3, IF y more than 3, then it is whatever the value of y is'. Thanks.

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

     

    Submitted by Richd on Wed, 02/10/2010 - 19:48.

    One way to do if or if-then is to use the 'merge block'. It has 3 inputs and 1 output. The output value is either the value on input pin 2 (true) or pin 3 (false) depending on the true/false value of the 'selector' on input pin 1.

    merge-block.png

    However, your case of low bound limiting of y could be handled by a single limit block with low bound set to 3 and upper bound set to a suitable infinity (1e300).

    The case block is similar to merge, except that instead of a Boolean top selector, it is a numeric index selector with a variable number of selection pins. If the selector has value 2 the output pin result is the value on input pin '2'.

    case-block.png

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by gingergine on Thu, 02/11/2010 - 14:23.

    Thanks Richid - it is much easy when there is someone to help you :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20'>

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by erasco on Tue, 03/23/2010 - 20:19.

    How do I go about creating a *.map file? I need a two-column look up table. I have tried Excel, wordpad and such but cannot find a 'save-as' .map option. Please help! Thanks, Eric

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pcavanagh on Fri, 10/01/2010 - 00:24.

    You could save blocks using a single expression block for a simple 'If Then Else'.

    The expression syntax for 'IF X<=3 THEN Y=3 ELSE Y=X' is '$1<=3?3:$1;' where $1 is the input to the expression block.