Пример #1
0
        /// <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);
            }
        }
Пример #2
0
 /// <summary>Cut the crop.</summary>
 public void Cut()
 {
     // Invoke a cutting event.
     if (Cutting != null)
     {
         Cutting.Invoke(this, new EventArgs());
     }
 }
Пример #3
0
 private void OnCut()
 {
     Cutting.Invoke();
 }