set a maximum value

Use this forum to post Vensim related questions.
Post Reply
gastoncoma
Junior Member
Posts: 13
Joined: Mon Aug 17, 2009 4:07 am

set a maximum value

Post 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!
gastoncoma
Junior Member
Posts: 13
Joined: Mon Aug 17, 2009 4:07 am

Post 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?
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

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

Post 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]
gastoncoma
Junior Member
Posts: 13
Joined: Mon Aug 17, 2009 4:07 am

Post by gastoncoma »

thanks indeed guys!:)
Post Reply