Exemple #1
0
        /////////////////////////////////////////////////////////////////////////////

        //                      SINGULAR LANDIS ITERATION ROUTINE                  //

        /////////////////////////////////////////////////////////////////////////////
        public static void singularLandisIteration(int itr, PDP ppdp, double[] wAdfGeoTransform)
        {
            DateTime ltime, ltimeTemp;
            TimeSpan ltimeDiff;


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

                if ((gDLLMode & Defines.G_HARVEST) != 0 && itr % sites.TimeStep_Harvest == 0)
                {
                    Console.WriteLine("Processing harvest events.\n");
                    ltime = DateTime.Now;
                    Harvest.GlobalFunctions.HarvestprocessEvents(itr / sites.TimeStep); //Global Function
                    putHarvestOutput(itr / sites.TimeStep_Harvest, wAdfGeoTransform);   //output img files
                    ltimeTemp = DateTime.Now;
                    ltimeDiff = ltimeTemp - ltime;
                    fpforTimeBU.WriteLine("Processing harvest: " + ltimeDiff + " seconds");
                }

                if (itr % sites.TimeStep == 0)
                {
                    ltime = DateTime.Now;
                    Console.WriteLine("Start succession ... at {0}", ltime);
                    system1.fseed(parameters.randSeed + itr / sites.TimeStep * 6);
                    landUnits.ReprodUpdate(itr / sites.TimeStep);
                    //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(parameters.randSeed);
        }
Exemple #2
0
        public static void succession_Landis70(PDP ppdp, int itr)
        {
            sites.GetMatureTree();

            //increase ages
            for (uint i = 1; i <= snr; ++i)
            {
                for (uint j = 1; j <= snc; ++j)
                {
                    ppdp.addedto_sTSLMortality((int)i, (int)j, (short)sites.TimeStep);
                    //define land unit
                    Landunit l = sites.locateLanduPt((int)i, (int)j);

                    if (l != null && l.active())
                    {
                        Site local_site = sites[(int)i, (int)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 = sites.locateLanduPt((int)i, (int)j);

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

                        if (local_RD < l.maxRDArray(0))
                        {
                            sites.SiteDynamics(0, i, j);
                        }

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

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

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

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