APSIMInitiative / APSIM710

APSIM
https://www.apsim.info
30 stars 47 forks source link

ApsimX: OilPalm tries to grow even though it has not been sown. #1350

Closed ApsimBot closed 5 years ago

ApsimBot commented 5 years ago

Legacy Bug ID: 1918 Author: Justin Date: 2014-07-08 11:51:11 +0000 UTC

This may occur in other crops as well. If the crop is not sown, the growth code will still run. The main effect of this is that Population is set to 0. Since C# allows division by 0 (it will generate a NaN value), the simulation will not throw an exception. The result being that it looks like everything ran ok (which it did as far as the computer is concerned) but anything that relies on Population or anything derived from it will report NaN values.

ApsimBot commented 5 years ago

Author: fai04d Date: 2014-07-08 20:15:00 +0000 UTC

This is an effect of how the models work in ApsimX. Add a check to the DoGrowth method.

ApsimBot commented 5 years ago

Author: fai04d Date: 2014-07-09 14:50:00 +0000 UTC

Added bool CropInGround to OilPalm and a check for it in OnDoPlantGrowth