How to exhaust a stock in just part of simulation

Use this forum to post Vensim related questions.
Post Reply
stumu
Junior Member
Posts: 6
Joined: Tue May 12, 2009 12:12 pm

How to exhaust a stock in just part of simulation

Post by stumu »

Hi,

I am trying to model dynamics of malaria and would like your help. I have attached part of the model where I need your assistance.

In the part of the model attached, there are two stocks; infected population and recovered population. The infected stock is initialized at 10,000,000 people and has 3 outflows; deaths, treated cases, and natural recoveries. Both treated and natural recoveries outflows feed (are inflows) into the recovered stock.

The proportion of the infected population that receives treatment takes 30 days to recover from malaria, while it takes 285 days for those that survive the disease to fully recover.

The assumption is that after 285 days the infected stock is empty.

As you will notice, the model is such that
INITIAL TIME = 2008
FINAL TIME = 2058
TIME STEP = 0.019 (about 7days).

I need two things:
1. To include both durations in the model; 30 days for the treated cases and 285 days for those that recover naturally.
2. The infected stock should be emptied in only 285 days.

Thank you

Stephen
Attachments
InfectedPopulation.mdl
(3.91 KiB) Downloaded 578 times
karankhosla
Senior Member
Posts: 107
Joined: Wed Nov 26, 2008 6:12 am

Response: "How to exhaust a stock in just part of simul

Post by karankhosla »

As the system time reaches one time constant, a stock (which has no inflow), empties 63% of its contents. By the second time constant it has emptied another 63% of the remaining contents and by the fifth or six time constant it has dumped almost 100% of its initial contents.

With reference to the recovery time:

One can be certain that the stock will be empty in 30 days if, say, seven (excessive, but proves the point) time constants were to pass; the time constant for recovery due to to treatment therefore should be 4.2 {days} (TC ~= 30/7).

Similarly the time constant for natural recovery is ~= 40.71 {days}

If I have understood your problem, I would create three stocks called "Infected People (IP.k)"{people}, "Recovered as Result of Treatment (RRT.k)" {people}and " "Naturally Recovered (NR.k)" {people}, there will also be two outflows, "treatment recovery rate (trr.jk)" {people/day} and "natural recovery rate (nrr.jk)"{people/day}. Constansts: treattimeconst = 4.2 (recovery time by treatment){day}, nattimeconst = 40.71 (natural recovery time) {day}

1) treatment recovery rate "trr.kl" links infected people to those that have recovered through treatment; the average time to recovery after treatment is 30 days.

trr.kl = IP.k/treattimeconst {people/day}

Assume that there are 100 infected people to start with, and there is no inflow or outflow of people from the stock of "Infected People". After 30 days (due to the value of "treattimeconst") 100 people will have passed through to the stock of Recovered as Result of Treatment (RRT.k).

Similarly "natural recovery rate (nrr.kl)" = IP.k/nattimeconst {people/day}

Again, assume that there are 100 infected people to start with, and there is no inflow or outflow of people from the stock of "Infected People". After 285 days, 100 people will have passed through to the stock of Recovered as Result of Treatment (RRT.k).

Of course when both outflows are linked to the stock of "Infected People", there is some competition for resources and this is where the dynamics of the system appear.

Also the time step of the system (DT) is usually chosen to be dependent on the order of the smallest delay: DT <= (Delay Time)/(4*Delay Type)

Attached is the model.

Best.

Karan

[Edited on 6-4-2009 by karankhosla]

[Edited on 6-4-2009 by karankhosla]
Attachments
MalariaBasic_KK.mdl
(2.84 KiB) Downloaded 711 times
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Malaria

Post by LAUJJL »

Hi Stephen

There are dimension errors in your model that hide conceptual difficulties. You should consider two different parameters for instance for the death rate. The proportion and the time to die: same for malaria cases treated.

The problem is not so simple. For instance you should consider the proportion of people being infected and being cured, and make two stocks, people cured and people not cured, etc...
Regards.
JJ
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Hi Steven,

You should work through all the units of measure in the model and maybe take a look at some published disease progression models (or even just flu.mdl discussed in Chapter 4 of the modeling guide). The usual equation for something like

deaths from malaria = infected population / average survival time

not this means that death will occur with a negative exponential distribution. This is a common, and usually reasonable, assumption. But it means that if the average survival time is 2 year that after 2 years only about 66% of the infected population will have died - this is because some survive for a longer time, others for a shorter time.

You may also need an additional stock for recovering patients depending on your purpose.
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Malaria

Post by LAUJJL »

Hi

Here is joined a model that could work and who has no apparent bug and is dimensionnally valid.
It has no true complex dynamic as the populations cured and not cured evoluates linearly. To include some dynamic one should include the effect of people infected on the non infected people.
Regards.
JJ
Attachments
InfectedPopulation2.mdl
(6.88 KiB) Downloaded 660 times
stumu
Junior Member
Posts: 6
Joined: Tue May 12, 2009 12:12 pm

Post by stumu »

Hi karankhosla,

Thanks for the tips. However, I should have mentioned that the model i gave you is just part of a big one. I specifically excluded an inflow to the infected stock simply because i wanted to look at a scenario where there are no new infections and then the infected stock is empited within 285 days. Another thing is that I would like to maintain the overall model settings; INITIAL TIME = 2008, FINAL TIME = 2058, TIME STEP = 0.019, and Unit for time =Year. These settings are applicable to the rest of the model. Also, the logic is such that due to budget constraints (not everybody in the population can be treated), the model should take care of the fraction that access treatment first, then apply a death rate to the remaining population next, and finally empty the reamaining population in the infected stock within 285 days.

I hope I have explained better now.

Stephen
karankhosla
Senior Member
Posts: 107
Joined: Wed Nov 26, 2008 6:12 am

Post by karankhosla »

Dear Stephen,

Attached is a model which should do what you want. I am using a cascading stock structure similar that of JJ's model.

Though I have to say this doesn't seem like a natural process for the systems I have come across in my studies, as per your requirements, the model will perform the following: the first step is to complete treatment, once this is complete, deaths from malaria start and this process is completed in 30 days or 8 percent of a year; once that is complete, the remaining population recovers naturally over 285 days or 78 percent of a year.

The explanation for the calculation of time constants is given in the comments for the rate equations.

A mass check shows that there is conservation of people in the system.

Best.

Karan

[Edited on 6-5-2009 by karankhosla]

[Edited on 6-5-2009 by karankhosla]
Attachments
MalariaBasicCascade_KK_MAIN.mdl
(7.25 KiB) Downloaded 660 times
Post Reply