You are here

minimum value

non-negativity of variables

I am struggling with clamping a 'compartment' so that it does not become negative. Trying to control this with 'if' statements on the outflow does not help. Probably because we really don't know which is the current value and comparing the current size of a compartment with the outflow does not do the trick. In the dialogue box where we set the initial condition for the compartment, the min and max boxes are actually active, so the assumption was that we can clamp it here. No luck: the value still goes negative.

It does seem to work if I use output = min(compartment, output)

Taxonomy upgrade extras: 
Subscribe to RSS - minimum value