Lookup function

Use this forum to post Vensim related questions.
Post Reply
rajaa1510
Junior Member
Posts: 7
Joined: Sat May 05, 2012 9:51 pm

Lookup function

Post by rajaa1510 »

Hi there,
I would like to know how I can writte an equation which include IF function and Lookup togather, I mean how can express the case (IF X =0 then Y=0, otherwise y= Graph(x1,y1), (x2,y2)...etc.)
It is simmply you can say add the value (0,0) to the graph, but, actually, this is not accceptable in my case.

Kind regards
Rajaa
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Lookup function

Post by Administrator »

Something like

Code: Select all

y = IF THEN ELSE ( x =0 , 0, lookup graph(x))
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
rajaa1510
Junior Member
Posts: 7
Joined: Sat May 05, 2012 9:51 pm

Re: Lookup function

Post by rajaa1510 »

Hi,
Thanks for your response.
Actually, what I need to know how to write this equation in the equation editor. Because If I wrote in the current case (IF THEN ELSE ( x =0 , 0, lookup graph(x))), Vensim would ask to identify the "lookup graph" as a variable!!

Regards
Rajaa
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Lookup function

Post by Administrator »

If you read through
http://www.vensim.com/documentation/ind ... ?usr08.htm

It will show you how to create a lookup (and how to use it).
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
rajaa1510
Junior Member
Posts: 7
Joined: Sat May 05, 2012 9:51 pm

Re: Lookup function

Post by rajaa1510 »

Hi,
Many thanks for your response.
I've already create the lookup graph. I have no problem in that. My problem is in how to include the lookup graph in the IF function.
For example,
effect of competition on fee= if then else (number of competitors=0, 1, Lookup graph(number of competitors))
where, effect of competition on fee= graph(2,1.33), (3, 1.2) .... (6,1)
I insert the values to get the lookup function as usual and I get the grap, but I do not know how to build IF function including this lookup function.
When I insert the equation in the equation editor as oyu told me above (y=if then else (x=0,0, lookup graph (x)), it considered "lookup graph" statemnet an indicator for an absent variable that I need to add it to my SD daigram as I recieved this message (do you want to add "lookup graph" to the model) instead of considering the "lookup graph" as a part of the IF fucntion.

I hope that I made myself clear
Many thanks for being patient

Kind regards
Rajaa
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: Lookup function

Post by Administrator »

Are you using PLE? If yes, just draw an arrow from your lookup to the variable where you need to use it.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
rajaa1510
Junior Member
Posts: 7
Joined: Sat May 05, 2012 9:51 pm

Re: Lookup function

Post by rajaa1510 »

Hi,
I am using DSS. I already drew this link and I wrot the equation in the way you told me but it does not work
Please find attached a graph ilustrating the link and equation
Regards
Rajaa
Graph.docx
(121.39 KiB) Downloaded 173 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Lookup function

Post by tomfid »

You're missing parentheses around the lookup argument. In other words, you have

IF THEN ELSE( a=b, x, lookup"y" )

and you need

IF THEN ELSE( a=b, x, lookup("y"))
Post Reply