/// <summary>Harvest the crop.</summary> public void RemoveBiomass(string biomassRemoveType, RemovalFractions removalData = null) { summary.WriteMessage(this, string.Format("Biomass removed from crop " + Name + " by " + biomassRemoveType.TrimEnd('e') + "ing")); // Invoke specific defoliation events. if (biomassRemoveType == "Harvest" && Harvesting != null) { Harvesting.Invoke(this, new EventArgs()); } if (biomassRemoveType == "Prune" && Pruning != null) { Pruning.Invoke(this, new EventArgs()); } if (biomassRemoveType == "LeafPluck" && LeafPlucking != null) { LeafPlucking.Invoke(this, new EventArgs()); } if (biomassRemoveType == "Cut" && Cutting != null) { Cutting.Invoke(this, new EventArgs()); } if (biomassRemoveType == "Graze" && Grazing != null) { Grazing.Invoke(this, new EventArgs()); } // Set up the default BiomassRemovalData values foreach (IOrgan organ in Organs) { // Get the default removal fractions OrganBiomassRemovalType biomassRemoval = null; if (removalData != null) { biomassRemoval = removalData.GetFractionsForOrgan(organ.Name); } organ.RemoveBiomass(biomassRemoveType, biomassRemoval); } // Reset the phenology if SetPhenologyStage specified. if (removalData != null && removalData.SetPhenologyStage != 0 && Phenology is Phenology phenology) { phenology.SetToStage(removalData.SetPhenologyStage); } // Reduce plant and stem population if thinning proportion specified if (removalData != null && removalData.SetThinningProportion != 0 && structure != null) { structure.DoThin(removalData.SetThinningProportion); } // Remove nodes from the main-stem if (removalData != null && removalData.NodesToRemove > 0) { structure.DoNodeRemoval(removalData.NodesToRemove); } }
/// <summary>Harvest the crop.</summary> public void RemoveBiomass(string biomassRemoveType, RemovalFractions removalData = null) { // Invoke an event. if (biomassRemoveType == "Harvest" && Harvesting != null) { Harvesting.Invoke(this, new EventArgs()); } Summary.WriteMessage(this, string.Format("Biomass removed from crop " + Name + " by " + biomassRemoveType.TrimEnd('e') + "ing")); // Set up the default BiomassRemovalData values foreach (IOrgan organ in Organs) { // Get the default removal fractions OrganBiomassRemovalType biomassRemoval = null; if (removalData != null) { biomassRemoval = removalData.GetFractionsForOrgan(organ.Name); } organ.DoRemoveBiomass(biomassRemoveType, biomassRemoval); } // Reset the phenology if SetPhenologyStage specified. if (removalData != null && removalData.SetPhenologyStage != 0) { Phenology.ReSetToStage(removalData.SetPhenologyStage); } // Reduce plant and stem population if thinning proportion specified if (removalData != null && removalData.SetThinningProportion != 0) { Structure.doThin(removalData.SetThinningProportion); } // Pruning event (winter pruning, summer pruning is called as cut) reset the phenology if SetPhenologyStage specified. if (biomassRemoveType == "Prune" && Pruning != null) { Pruning.Invoke(this, new EventArgs()); } }