something like a DOWHILE?

Use this forum to post Vensim related questions.
Post Reply
Steve Taff
Junior Member
Posts: 13
Joined: Tue Jun 28, 2005 6:27 pm

something like a DOWHILE?

Post 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.
Steven J. Taff
Department of Applied Economics
University of Minnesota
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

Post 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.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

You can also use the SIMULTANEOUS function - see NEP3SIMU and NEPRON5 examples in the sample model Extra folder.
Steve Taff
Junior Member
Posts: 13
Joined: Tue Jun 28, 2005 6:27 pm

Post by Steve Taff »

Thanks, Bob and Tony, for your ideas. Optimization won't work in this situation, but maybe SIMULTANEOUS.....
Steve Taff
Junior Member
Posts: 13
Joined: Tue Jun 28, 2005 6:27 pm

Post by Steve Taff »

FIND ZERO turned the trick. Thanks for the help.
Steven J. Taff
Department of Applied Economics
University of Minnesota
Post Reply