Ecological modelling of agroforestry systems