Hi guys, first time here.
How do you set the minimum population so to not get negative numbers?
Cheers
setting max and minimums
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
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.
-
- Senior Member
- Posts: 107
- Joined: Wed Nov 26, 2008 6:12 am
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
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