logical operators

Use this forum to post Vensim related questions.
Post Reply
Danny
Junior Member
Posts: 10
Joined: Fri Apr 25, 2008 11:42 am

logical operators

Post by Danny »

I have a problem with an IF THEN ELSE function.
The function is the following:
measure= IF THEN ELSE (threshold1>=value1 :OR: threshold2>=value2 :OR: threshold3>=value3, 100, 0)

There is a problem with the logical operators. I want to express that, if one or more of the thresholds are reached or exceeded, measure turns 0. But it doesn't work.
Is it not possible to include :OR: in an IF THEN ELSE function? Probably I need to include :AND: somehow to state that the IF conditions can also happen in combination. :AND: or :NOT: are included in the Users Guide (as examples), so I expected :OR: to work as well...?

Danny
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

The expression you have is valid and will return 100 if any one of the thresholds exceeds the value, otherwise it will return 0. Thus the way you have it all thresholds need to be exceeded to get 0. To get what you want you would use

IF THEN ELSE(value1 >= threshold1 :OR: value2 >= theshold2 :OR: value3 >= threshold3,0,100)
Danny
Junior Member
Posts: 10
Joined: Fri Apr 25, 2008 11:42 am

Post by Danny »

Thank you. Of course it works now.
Sorry for that stupid question, but I've just gone blank with this problem.

Thanks for the help,
Danny
Post Reply