Page 1 of 1

something like a DOWHILE?

Posted: Mon Sep 08, 2008 4:58 pm
by Steve Taff
I'm trying to model a behavior that is sort of like a DO WHILE statement: I keep adjusting the size of a pile until it meets a condition, at which point the model moves on.

So, for example, I reduce the total pollution of a system (the criterion) by cutting back output of one technology. In order to satisfy demand, I replace this output with that from another less polluting technology. So total pollution goes down, but not (yet) to desired levels. I then reduce the first technology even further and replace it with output from a less (but still nonzero) polluting technology. This continues until the total pollution meets a critical level, and all the while output demand is satisfied.

I can't see how to do a "simple" transform for this algorith, unless there's some very clever way to use ALLOC. I think I could do this in a SD way if Vensim let me loop through the level lots of times before moving on, but I think that any subdivision of a single time step would require that all time steps in the model be so subdivided.

Anybody know of way to do this, perhaps an independent module? Thanks in advance.

Posted: Mon Sep 08, 2008 5:29 pm
by Administrator
Take a look at the FIND ZERO function (I have used this in the past in a similar way).

http://www.vensim.com/documentation/html/22430.htm

Alternatively you could use the optimizer.

Hope this helps.

Tony.

Posted: Mon Sep 08, 2008 7:28 pm
by bob@vensim.com
You can also use the SIMULTANEOUS function - see NEP3SIMU and NEPRON5 examples in the sample model Extra folder.

Posted: Tue Sep 09, 2008 2:37 pm
by Steve Taff
Thanks, Bob and Tony, for your ideas. Optimization won't work in this situation, but maybe SIMULTANEOUS.....

Posted: Mon Sep 15, 2008 2:02 pm
by Steve Taff
FIND ZERO turned the trick. Thanks for the help.