Example #1
0
        /// <summary>
        /// Removes nodes from main-stem in defoliation event
        /// </summary>
        /// <param name="NodesToRemove"></param>
        public void doNodeRemoval(int NodesToRemove)
        {
            //Remove nodes from Structure properties
            LeafTipsAppeared    = Math.Max(LeafTipsAppeared - NodesToRemove, 0);
            PotLeafTipsAppeared = Math.Max(PotLeafTipsAppeared - NodesToRemove, 0);

            //Remove corresponding cohorts from leaf
            int NodesStillToRemove = Math.Min(NodesToRemove + Leaf.ApicalCohortNo, Leaf.InitialisedCohortNo);

            while (NodesStillToRemove > 0)
            {
                TipToAppear        -= 1;
                CohortToInitialise -= 1;
                Leaf.RemoveHighestLeaf();
                NodesStillToRemove -= 1;
            }
            TipToAppear        = Math.Max(TipToAppear + Leaf.CohortsAtInitialisation, 1);
            CohortToInitialise = Math.Max(CohortToInitialise, 1);
            //Reinitiate apical cohorts ready for regrowth
            if (Leaf.InitialisedCohortNo > 0) //Sone cohorts remain after defoliation
            {
                for (int i = 1; i <= Leaf.CohortsAtInitialisation; i++)
                {
                    InitParams          = new CohortInitParams();
                    CohortToInitialise += 1;
                    InitParams.Rank     = CohortToInitialise;
                    if (AddLeafCohort != null)
                    {
                        AddLeafCohort.Invoke(this, InitParams);
                    }
                }
            }
            else   //If all nodes have been removed initalise again
            {
                Leaf.Reset();
                InitialiseLeafCohorts.Invoke(this, args);
                Initialised = true;
                DoEmergence();
            }
        }
Example #2
0
        /// <summary> Removes nodes from main-stem in defoliation event  </summary>
        public void DoNodeRemoval(int NodesToRemove)
        {
            //Remove nodes from Structure properties
            LeafTipsAppeared    = Math.Max(LeafTipsAppeared - NodesToRemove, 0);
            PotLeafTipsAppeared = Math.Max(PotLeafTipsAppeared - NodesToRemove, 0);

            //Remove corresponding cohorts from leaf
            int NodesStillToRemove = Math.Min(NodesToRemove + leaf.ApicalCohortNo, leaf.InitialisedCohortNo);

            while (NodesStillToRemove > 0)
            {
                TipToAppear        -= 1;
                CohortToInitialise -= 1;
                leaf.RemoveHighestLeaf();
                NodesStillToRemove -= 1;
            }
            //TipToAppear = Math.Max(TipToAppear + leaf.CohortsAtInitialisation, 1);
            CohortToInitialise = Math.Max(CohortToInitialise, 1);
            if (CohortToInitialise == LeafTipsAppeared) // If leaf appearance had reached final leaf number need to add another cohort back to get things moving again.
            {
                CohortToInitialise += 1;
            }
            InitParams = new CohortInitParams()
            {
            };
            InitParams.Rank = CohortToInitialise;
            if (AddLeafCohort != null)
            {
                AddLeafCohort.Invoke(this, InitParams);
            }
            //Reinitiate apical cohorts ready for regrowth
            if (leaf.InitialisedCohortNo == 0) //If all nodes have been removed initalise again
            {
                leaf.Reset();
                InitialiseLeafCohorts.Invoke(this, new EventArgs());
                DoLeafInitilisation();
            }
        }