Prevent negative stock

Use this forum to post Vensim related questions.
Post Reply
veasna_kum
Junior Member
Posts: 2
Joined: Sun Nov 07, 2010 8:36 pm

Prevent negative stock

Post by veasna_kum »

Hello Everyone,
I am a graduate student applying system dynamics method to study the dynamics of plankton population subject to water flow change. I replicate the model from classical water quality model showing relationship between nutrient and plankton population. I cannot prevent negative stock of nutrient and the If Then Else formulation does not help. I have tried to consult text by Prof Sterman but still cannot find the way to deal with the problem. It is hard to describe completely the problem in this message. I will be very happy to send model to those who may want to play with it.
Please help. I very much appreciate your comment or suggestion.
I look forward to hearing your advice.
Sincerely,
Veasna
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

Upload the model to the forum and we can take a look.
karankhosla
Senior Member
Posts: 107
Joined: Wed Nov 26, 2008 6:12 am

Post by karankhosla »

Hi Veasna,

Suppose for a moment that you have a simple stock of "Plankton with an outflow "death rate"; if the rate of outflow "death rate" has no feedback about the level of the stock of "plantkon" it is possible, over time, for the stock to become negative, which makes no physical sense as you pointed out. However, it is possible to define the outflow as decision process which chooses the lesser of two rates: the "external death rate", which could depend on external factors, and a rate of deaths which is proportional to the level plankton.

death rate {plantkon/day} = MIN("external death rate", "proportional death rate")

"external death rate" is a function of, for example, nutrients, overcrowding etc {plankton/day}

"proportional death rate" = "Plankton"/"Av. Plankton Lifetime" {plankton/day} - this is a common first order feedback control from the stock of Plankton to the outflow.

Hence, if the "external death rate" is less than the "proportional death rate" , the outflow will choose the former rate, until the stock of "plankton" decreases to the point where "proportional death rate" is less than "external death rate" (you will see a discontinuity in the "death rate" at this point) - at this point will decrease to zero in a first order manner, with a time constant of "Av. Plankton Lifetime".

For the inflow (migration, for example), you should add a constraint as follows: "inflow" = MAX(0,"desired inflow")

This constrains the inflow from going negative.

Model attached.

[Edited on 11-8-2010 by karankhosla]
Attachments
Plankton_KK.mdl
(2.11 KiB) Downloaded 565 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

Karan's solution is a good one.

The fact that you are having this problem when working with replicated equations suggests that either there was some flaw in the classic analysis, or that your replication somehow differs in assumptions from the original. One possibility is that the original equations were written for continuous time, and your TIME STEP is too large. A good test would be to simply cut the TIME STEP in half a few times to see if the negative stock problem disappears, or switch to RK4 auto integration method.
veasna_kum
Junior Member
Posts: 2
Joined: Sun Nov 07, 2010 8:36 pm

Re: Prevent negative stock

Post by veasna_kum »

Thank you so much for those who have answered to my question.
Sincerely,
Veasna
Post Reply