コード例 #1
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Initializes the extension with a data file.
        /// </summary>

        public override void Initialize()
        {
            Timestep          = parameters.Timestep;
            Timestep          = 1; //parameters.Timestep;
            mapNameTemplate   = parameters.MapNamesTemplate;
            manyInsect        = parameters.ManyInsect;
            activeInsectIndex = 0;

            MetadataHandler.InitializeMetadata(parameters.Timestep, parameters.MapNamesTemplate, parameters.LogFileName, manyInsect, ModelCore);
            SiteVars.Initialize();
            Defoliate.Initialize(parameters);
            GrowthReduction.Initialize(parameters);

            // ARJAN
            //if (Landis.Extension.Succession.Biomass.PlugIn.SuccessionTimeStep != 1)
            //     PlugIn.ModelCore.UI.WriteLine("  CAUTION!  If using Biomass Insects, Biomass Succession should be operating at an ANNUAL time step.");

            foreach (IInsect insect in manyInsect)
            {
                if (insect == null)
                {
                    PlugIn.ModelCore.UI.WriteLine("  Caution!  Insect Parameters NOT loading correctly.");
                }

                insect.Neighbors = GetNeighborhood(insect.NeighborhoodDistance);
                // PlugIn.ModelCore.UI.WriteLine("   Biomass Insects:  Dispersal Neighborhood = {0} neighbors.", i);
                insect.LastBioRemoved = 0;
            }
        }
コード例 #2
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Initializes the extension with a data file.
        /// </summary>

        public override void Initialize()
        {
            Timestep        = parameters.Timestep;
            Timestep        = 1; //parameters.Timestep;
            mapNameTemplate = parameters.MapNamesTemplate;
            manyInsect      = parameters.ManyInsect;

            MetadataHandler.InitializeMetadata(parameters.Timestep, parameters.MapNamesTemplate, parameters.LogFileName, manyInsect, ModelCore);
            SiteVars.Initialize();
            Defoliate.Initialize(parameters);
            GrowthReduction.Initialize(parameters);

            // ARJAN
            //if (Landis.Extension.Succession.Biomass.PlugIn.SuccessionTimeStep != 1)
            //     PlugIn.ModelCore.UI.WriteLine("  CAUTION!  If using Biomass Insects, Biomass Succession should be operating at an ANNUAL time step.");

            foreach (IInsect insect in manyInsect)
            {
                if (insect == null)
                {
                    PlugIn.ModelCore.UI.WriteLine("  Caution!  Insect Parameters NOT loading correctly.");
                }

                insect.Neighbors = GetNeighborhood(insect.NeighborhoodDistance);

                //int i=0;

                //foreach(RelativeLocation location in insect.Neighbors)
                //    i++;

                //if(insect.Neighbors != null)
                // PlugIn.ModelCore.UI.WriteLine("   Biomass Insects:  Dispersal Neighborhood = {0} neighbors.", i);
                insect.LastBioRemoved = 0;
            }


            /* PlugIn.ModelCore.UI.WriteLine("   Opening BiomassInsect log file \"{0}\" ...", parameters.LogFileName);
             * try {
             *  log = Landis.Data.CreateTextFile(parameters.LogFileName);
             * }
             * catch (Exception err) {
             *  string mesg = string.Format("{0}", err.Message);
             *  throw new System.ApplicationException(mesg);
             * }
             *
             * log.AutoFlush = true;
             * log.Write("Time,InsectName,StartYear,StopYear,MeanDefoliation,NumSitesDefoliated0_33,NumSitesDefoliated33_66,NumSitesDefoliated66_100,NumOutbreakInitialSites,MortalityBiomassKg");
             * log.WriteLine("");
             * */
        }