示例#1
0
        /////////////////////////////////////////////////////////////////////////////

        //                      SINGULAR LANDIS ITERATION ROUTINE                  //

        /////////////////////////////////////////////////////////////////////////////



        //This processes a singular Landis iteration.  It loops through each site
        //followed by each species.  For every iteration of the loop grow and kill
        //are called.  Then seed availability is checked.  If seed is available
        //and shade conditions are correct birth is called.
        public void singularLandisIteration(int itr, pdp ppdp)
        {
            DateTime ltime, ltimeTemp;
            TimeSpan ltimeDiff;


            using (StreamWriter fpforTimeBU = File.AppendText(fpforTimeBU_name))
            {
                fpforTimeBU.WriteLine("\nProcessing succession at Year: {0}:", itr);


                if (itr % gl_sites.SuccessionTimeStep == 0)
                {
                    ltime = DateTime.Now;

                    Console.WriteLine("Start succession ... at {0}", ltime);

                    system1.fseed(gl_param.RandSeed + itr / gl_sites.SuccessionTimeStep * 6);

                    gl_landUnits.ReprodUpdate(itr / gl_sites.SuccessionTimeStep);
                    //Console.WriteLine("random number: {0}", system1.frand());
                    succession_Landis70(ppdp, itr);
                    //Console.WriteLine("random number: {0}", system1.frand());
                    ltimeTemp = DateTime.Now;

                    ltimeDiff = ltimeTemp - ltime;

                    Console.WriteLine("Finish succession at {0} sit took {1} seconds", DateTime.Now, ltimeDiff);

                    fpforTimeBU.WriteLine("Processing succession: {0} seconds", ltimeDiff);

                    fpforTimeBU.Flush();
                }
            }

            system1.fseed(gl_param.RandSeed);
        }
示例#2
0
        public static void succession_Landis70(pdp ppdp, int itr)
        {
            gl_sites.GetMatureTree();

            //increase ages
            for (uint i = 1; i <= snr; ++i)
            {
                for (uint j = 1; j <= snc; ++j)
                {
                    ppdp.addedto_sTSLMortality(i, j, (short)gl_sites.SuccessionTimeStep);

                    //define land unit
                    landunit l = gl_sites.locateLanduPt(i, j);

                    if (l != null && l.active())
                    {
                        site local_site = gl_sites[i, j];

                        for (int k = 1; k <= specAtNum; ++k)
                        {
                            local_site.SpecieIndex(k).GrowTree();
                        }
                    }
                }
                //Console.ReadLine();
            }

            //seed dispersal
            initiateRDofSite_Landis70();
            Console.WriteLine("Seed Dispersal:");


            for (uint i = 1; i <= snr; ++i)
            {
                //Console.WriteLine("\n{0}%\n", 100 * i / snr);

                for (uint j = 1; j <= snc; ++j)
                {
                    //Console.WriteLine("i = {0}, j = {1}", i, j);
                    landunit l = gl_sites.locateLanduPt(i, j);

                    KillTrees(i, j);
                    if (itr == 90 && i == 193 && j == 156)
                    {
                        Console.WriteLine("watch: {0}:{1}", "kill trees", gl_sites[193, 156].SpecieIndex(2).getAgeVector(1));
                    }
                    if (l != null && l.active())
                    {
                        float local_RD = gl_sites[i, j].RD;

                        if (local_RD < l.MaxRDArray(0))
                        {
                            gl_sites.SiteDynamics(0, i, j);
                        }

                        else if (local_RD >= l.MaxRDArray(0) && local_RD < l.MaxRDArray(1))
                        {
                            gl_sites.SiteDynamics(1, i, j);
                        }

                        else if (local_RD >= l.MaxRDArray(1) && local_RD <= l.MaxRDArray(2))
                        {
                            gl_sites.SiteDynamics(2, i, j);
                        }

                        else if (local_RD > l.MaxRDArray(2) && local_RD <= l.MaxRDArray(3))
                        {
                            gl_sites.SiteDynamics(3, i, j);
                        }

                        else
                        {
                            Debug.Assert(local_RD > l.MaxRDArray(3));
                            gl_sites.SiteDynamics(4, i, j);
                        }
                    }
                }
            }
            Console.WriteLine("end succession_Landis70 once");
        }