Page 1 of 1
setting max and minimums
Posted: Mon Aug 17, 2009 6:07 am
by gastoncoma
Hi guys, first time here.
How do you set the minimum population so to not get negative numbers?
Cheers
Posted: Mon Aug 17, 2009 10:27 am
by bob@vensim.com
Population is normally a level and can only be decreased by deaths which in turn depend on population. That feedback guarantees it will never go negative. If you are having numerical problems you might switch to Runge-Kutta integration or decrease TIME STEP. If it is more than just numerical problems double check your equations.
Posted: Thu Aug 20, 2009 11:25 am
by karankhosla
One way to prevent negative stocks is to use MIN and MAX functions in the following way:
For Inflow (IR): IR = MAX(0, Desired Inflow),
where Desired Inflow could be whatever. This way if Desired Inflow is negative the flow constrains it self to 0.
For Outfow (OR): OR = MIN(Maximum Outflow, Desired Outflow),
where Maximum Outflow is, for example, the (Stock)/(Min. Time to Process Each Stock Member). Desired Outflow can be whatever; hence, if Desired Outflow is greater than Maximum outflow, the OR chooses Maximum Outflow and the Stock cannot be drained into the negative.
Best Wishes,
Karan
Posted: Sun Aug 30, 2009 10:16 pm
by gastoncoma
thanks karan!!