Vensim Compare Help

Use this forum to post Vensim related questions.
Post Reply
Jin
Junior Member
Posts: 2
Joined: Tue Apr 27, 2010 5:25 pm

Vensim Compare Help

Post by Jin »

Im trying to use a range of numbers in an IF THEN ELSE type of situation. so at 100 the number would be say 5 but at 20 the number would be 3. Im running into problems trying to implement this and could use a little help.
tomfid
Administrator
Posts: 3995
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

One possibility:

output = IF THEN ELSE( input = 100, 5, IF THEN ELSE( input = 20, 3, ... ))

If you have more than one or two states, this is likely to get confusing. You might consider a lookup instead.

Check the User's Guide, Chapter 8, "building a function with lookups"

Tom
Jin
Junior Member
Posts: 2
Joined: Tue Apr 27, 2010 5:25 pm

Post by Jin »

ok, how do i create a look up and use it in this situation. Im very new to using this software so im a little lost.
tomfid
Administrator
Posts: 3995
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

Again, Help>Vensim Manuals>Contents - Chapter 8 is your best bet.

Alternatively, take a look at some sample models, which are typically in your Vensim directory. For example, C:\Program Files\Vensim\models\guide\CHAP08\COMPLETE\RABBIT3 has an example lookup, "effect of rabbit crowding on deaths".

Tom
Administrator
Super Administrator
Posts: 4841
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Would this work

value = IF THEN ELSE ( time = 10, 5 , 0 )
+ IF THEN ELSE ( time = 20, 6 , 0 )
+ IF THEN ELSE ( time = 30, 7 , 0 )
+ IF THEN ELSE ( time = 40, 8 , 0 )
+ IF THEN ELSE ( time = 50, 9 , 0 )
Post Reply