protected void OnDoActualPlantGrowth(object sender, EventArgs e) { if (parentPlant.IsAlive) { // Do senescence double senescedFrac = senescenceRate.Value(); if (Live.Wt * (1.0 - senescedFrac) < BiomassToleranceValue) { senescedFrac = 1.0; // remaining amount too small, senesce all } Biomass Loss = Live * senescedFrac; Live.Subtract(Loss); Dead.Add(Loss); Senesced.Add(Loss); // Do detachment double detachedFrac = detachmentRateFunction.Value(); if (Dead.Wt * (1.0 - detachedFrac) < BiomassToleranceValue) { detachedFrac = 1.0; // remaining amount too small, detach all } Biomass detaching = Dead * detachedFrac; Dead.Multiply(1.0 - detachedFrac); if (detaching.Wt > 0.0) { Detached.Add(detaching); surfaceOrganicMatter.Add(detaching.Wt * 10, detaching.N * 10, 0, parentPlant.CropType, Name); } // Do maintenance respiration MaintenanceRespiration = 0; MaintenanceRespiration += Live.MetabolicWt * maintenanceRespirationFunction.Value(); MaintenanceRespiration += Live.StorageWt * maintenanceRespirationFunction.Value(); } }
protected void OnDoActualPlantGrowth(object sender, EventArgs e) { if (parentPlant.IsAlive) { // Do detachment double detachedFrac = detachmentRateFunction.Value(); if (Dead.Wt * (1.0 - detachedFrac) < BiomassToleranceValue) { detachedFrac = 1.0; // remaining amount too small, detach all } Biomass detaching = Dead * detachedFrac; Dead.Multiply(1.0 - detachedFrac); if (detaching.Wt > 0.0) { Detached.Add(detaching); surfaceOrganicMatter.Add(detaching.Wt * 10, detaching.N * 10, 0, parentPlant.PlantType, Name); } // Do maintenance respiration if (maintenanceRespirationFunction.Value() > 0) { MaintenanceRespiration = (Live.MetabolicWt + Live.StorageWt) * maintenanceRespirationFunction.Value(); Live.MetabolicWt *= (1 - maintenanceRespirationFunction.Value()); Live.StorageWt *= (1 - maintenanceRespirationFunction.Value()); } } }