Compartmental analysis of ecosystem models