Errors with WITH LOOK UP function

Use this forum to post Vensim related questions.
Post Reply
ngtrang
Junior Member
Posts: 18
Joined: Thu Dec 08, 2022 9:22 am
Vensim version: DSS

Errors with WITH LOOK UP function

Post by ngtrang »

Could you tell me if there is any error related to missed parens in the following equation? I tried but could not fix it.
Thank you.

Cost of waste recycling = Transportation cost+WITH LOOKUP(maturation of waste recycling market, ((0.15,40),(0.2,35),(0.3,30),(0.4,27),(0.5,23),(0.6,18),(0.7,16),(0.8,14)))

The Vensim notified about an error with Lookup function: look for missing parens
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: Errors with WITH LOOK UP function

Post by tomfid »

I think the error message may be misleading. WITH LOOKUP has to be the first & only thing on the right side of the equation - that's probably the issue here.
ngtrang
Junior Member
Posts: 18
Joined: Thu Dec 08, 2022 9:22 am
Vensim version: DSS

Re: Errors with WITH LOOK UP function

Post by ngtrang »

tomfid wrote: Sun Feb 05, 2023 5:31 pm I think the error message may be misleading. WITH LOOKUP has to be the first & only thing on the right side of the equation - that's probably the issue here.
Thank you so much, I understood the issue here.
What other function can I use in case I want to calculate the total cost as equal to transportation cost plus recycling cost (for example) which in turn depends on the maturation of the market? I mean a combined functions like the inital idea.
Administrator
Super Administrator
Posts: 4667
Joined: Wed Mar 05, 2003 3:10 am

Re: Errors with WITH LOOK UP function

Post by Administrator »

ngtrang wrote: Mon Feb 06, 2023 7:10 amWhat other function can I use in case I want to calculate the total cost as equal to transportation cost plus recycling cost (for example) which in turn depends on the maturation of the market? I mean a combined functions like the inital idea.
It's probably best if you start a new topic and provide more details.
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
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: Errors with WITH LOOK UP function

Post by tomfid »

Just create a separate variable.

z = x + y
y = WITH LOOKUP(...)
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: Errors with WITH LOOK UP function

Post by tomfid »

Or use an ordinary lookup variable instead of WITH LOOKUP:

z = x + y( input )
y = (0,1),(1,2),(3,4), ...
ngtrang
Junior Member
Posts: 18
Joined: Thu Dec 08, 2022 9:22 am
Vensim version: DSS

Re: Errors with WITH LOOK UP function

Post by ngtrang »

tomfid wrote: Mon Feb 06, 2023 3:08 pm Or use an ordinary lookup variable instead of WITH LOOKUP:

z = x + y( input )
y = (0,1),(1,2),(3,4), ...
Thank you :D
ngtrang
Junior Member
Posts: 18
Joined: Thu Dec 08, 2022 9:22 am
Vensim version: DSS

Re: Errors with WITH LOOK UP function

Post by ngtrang »

tomfid wrote: Mon Feb 06, 2023 3:07 pm Just create a separate variable.

z = x + y
y = WITH LOOKUP(...)
Thank you. I am trying to re-establish the model found from a published paper to understand the methodology. The authors explained a formula in which x = a + WITH LOOKUP (y). Then I tried doing similar things but now I know WITH LOOKUP can not be used in such a combination like this.
Administrator
Super Administrator
Posts: 4667
Joined: Wed Mar 05, 2003 3:10 am

Re: Errors with WITH LOOK UP function

Post by Administrator »

I always discourage the use of WITH LOOKUP, I'm not sure why anyone uses it. It much better to define the lookup as a separate variable.
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
tomfid
Administrator
Posts: 3856
Joined: Wed May 24, 2006 4:54 am

Re: Errors with WITH LOOK UP function

Post by tomfid »

I don't discourage it, but I tend to use regular lookups in my own work. WITH LOOKUP is fine if you'll only use the curve shape once.

I'm puzzled that the authors describe x = a + WITH LOOKUP (y) - that hasn't ever worked, and the function is more or less unique to Vensim. Perhaps it was simply a shorthand.
domenicacox36
Newbie
Posts: 1
Joined: Wed Jun 26, 2024 10:15 am
Vensim version: PLE

Re: Errors with WITH LOOK UP function

Post by domenicacox36 »

Hi, i am also have issues with creating LOOKUP functions in Venism PLE. I am trying to create a look up function for the impact of a policy throughout time (2024-2050) so that i can use it to show that the policy will have a non-linear impact on other variables in my model depending on the year. However, when I create an auxillary variable and use the =WITHLOOKUP (ImpactLSP([(2024, 0)-(2050, 1)],(2024, 0.3),(2025,0.35),(2026,0.4)
(2027, 0.2), (2028,0.19),(2029, 0.1)). I am getting the error "expecting an operator". Do you know why this might be. Any help would be really appreciated.
Post Reply