One level with two outflows

Use this forum to post Vensim related questions.
Post Reply
irene
Member
Posts: 22
Joined: Wed Aug 24, 2011 3:07 pm

One level with two outflows

Post by irene »

Hello
I have one question, i hope you could answer me.
I have one level and two outflows. is there a way to tell vensim to consider first outflow 1 and then outflow 2? because at the moment if for example there are 5 units in the level and outflow 1 is 5 units/day and outflow 2 is 5 units/day, then level becomes negative (-5). it seems that both outflows are decreasing the lever at the same time without considering each other and the level becomes negative!!
thank you very much
irene
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: One level with two outflows

Post by gwr »

Hello Irene,

you should think very systematically through your model and ask yourself "what is having influence on this variable?" or "what information is needed to determine this variable?" - with variable being stock or flow/auxiliary. If you do this you will end up having to ask yourself whether the outflow 1 does have (for whatever reasons) influence on the strength of outflow 2. If it has than you would have a causal link (arrow) from outflow 1 to outflow 2 and then you can model this influence.

Furthermore, since you want to prevent negativity in the stock - which is not prevented per se - the amount in the stock itself is an information that influences the outflow 1 - or rather both outflows. A simple example how to model this would be:

Code: Select all

stock = INTEG ( -outflow 1 - outflow 2 , initial value of stock) ~~|
maximum outflow = stock/time step ~~ the maximal outflow that is possible without draining the stock into negativity |
outflow 1 = MIN( desired value for outflow 1, maximum outflow ) ~~|
outflow 2 = MIN( desired value for outflow 2, maximum outflow - outflow 1) ~~|
Kind regards,

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

Re: One level with two outflows

Post by Administrator »

There are two simple ways of doing what you want.

The first way is what Guido suggests (take into account the amount removed from the stock by outflow 1 when calculating outflow 2). The attached model "demo.mdl" demonstrates this.

The second way is to proportionally allocate what is in the stock to the outflows. The attached model "demo2.mdl" demonstrates this.

In both cases, the control mechanisms for preventing the stock going negative only happen when there is less in the stock than you want to remove.

Hope this helps.

Tony.
Attachments
demo2.mdl
(2.83 KiB) Downloaded 704 times
demo.mdl
(2 KiB) Downloaded 721 times
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
irene
Member
Posts: 22
Joined: Wed Aug 24, 2011 3:07 pm

Re: One level with two outflows

Post by irene »

Many thanks for your help,
I will take all your advices into consideration and hope to solve my problem.
irene
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: One level with two outflows

Post by gwr »

Hi Irene and Tony,

regarding Tonys suggestion to use a proportional split to distribute the total outflow onto the two (or however many) outflows one might want to make sure that this adds up to the maximum possible outflow. The reason being rounding errors. So maybe it is a good idea to have all but one flow be calculated as a proportion (e.g. by multiplication) and then to have the remaining flow be:

last flow = maximum possible flow - SUM (all other flows)

This should make sure that everything comes down to "zero" and not to some number below. But maybe there is another way to do this, Tony?

Kind regards,

Guido
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: One level with two outflows

Post by gwr »

Regarding the issue of two outflows with one being dominant, Jean-Jacques Laublé has just pointed to an issue in the World 3 model that ships with Vensim. In the population sub model there the outflows to the stock of adolescents (0 to 14 year-old persons) is modeled as a proportional split as Tony suggested, e.g.

Code: Select all

deathrate = population x mortality
rate of maturing = population x ( 1 - mortality) / duration of adolescence
For most purposes this formulation might serve its purpose ableit it is not robust as the rate of maturing can become negative in case of a sudden increase in mortality. I suggest you also refer to this thread:

http://www.ventanasystems.co.uk/forum/v ... =15&t=4710

Best,
Guido
irene
Member
Posts: 22
Joined: Wed Aug 24, 2011 3:07 pm

Re: One level with two outflows

Post by irene »

thank you, thank you!!
Post Reply