Hi Francesco,
You're almost there:
You simply use round brackets (...) instead of the square brackets
[...]
I.e.
if assimilate_surplus>0 then leaf_goal else (if
(canopy_production-stem_respiration)>0 then
(canopy_production-stem_respiration) else 0)
It's a good idea to add a space after the 'else'.
I haven't actually tested this, so get back to me if I've missed
something.
The inner round brackets you used are strictly speaking not
necessary, so it can simplified to :
if assimilate_surplus>0 then leaf_goal else (if
canopy_production-stem_respiration>0 then
canopy_production-stem_respiration else 0)
which shows the structure somewhat more clearly.
Square brackets are used in Simile, but have a totally different
meaning (they indicate that a variable is an array - i.e. has
multiple values instead of just one - or they bracket a set of
comma-separate values which are to be treated together).
The Simile Help entry on conditional expressions can be found at
http://www.simulistics.com/help/equations/conditions.htm.
This mentions the possibility of nesting conditionals (as you want),
but does not currently explicitly mention that the use of round
brackets for the nested conditional is necessary (I've just
checked). I'll fix it, so in future it should make this clear.
Thanks for raising this issue.
Cheers,
Robert