Page 1 of 1
set a maximum value
Posted: Sun Aug 30, 2009 10:10 pm
by gastoncoma
Hi how's it going,
I want to set a maximum value for a variable (maximum population grouth must be 8000, so it should not go further up than 8000). How do I set that up?
Cheers!
Posted: Sun Aug 30, 2009 10:24 pm
by gastoncoma
Do you think this is correct?
MAX (0:AND:8000, movement A+rep-mort-surv-movement B)
So the population will keep in between the values of 0 and 8000. Am I understanding?
Posted: Mon Aug 31, 2009 8:44 am
by Administrator
I think what you are trying to do is this
MAX ( 0 , MIN ( 8000, movement A+rep-mort-surv-movement B) )
It would be better still to have
MAX ( 0 , MIN ( maximum population growth, movement A+rep-mort-surv-movement B) )
maximum population growth = 8000
Tony.
Posted: Mon Aug 31, 2009 10:31 am
by bob@vensim.com
A couple of things.
1. Try never to embed numbers in equations. So you should use
population change rate = MIN(indicated population change rate, maximum population change rate)
where
maximum population change rate = 8000
and
indicated population change rate = movement A+rep-mort-surv-movement B
2. You should not need to do anything to be sure that "indicated population change rate" is positive. In this case I can't see any reason why it should not go negative. If there is then you should fix the causal factor (eg mort) that has the problem not adjust the equation with a min.
[Edited on 2009-8-31 by
bob@vensim.com]
Posted: Mon Aug 31, 2009 8:08 pm
by gastoncoma
thanks indeed guys!:)