Beispiel #1
0
        //---------------------------------------------------------------------
        protected override void InitializeSite(ActiveSite site)//,ICommunity initialCommunity)
        {
            lock (threadLock)
            {
                if (m == null)
                {
                    m = new MyClock(PlugIn.ModelCore.Landscape.ActiveSiteCount);
                }

                m.Next();
                m.WriteUpdate();
            }

            uint key = 0;

            allKeys.TryGetValue(site, out key);
            ICommunity initialCommunity = null;

            if (!sitesAndCommunities.TryGetValue(site, out initialCommunity))
            {
                throw new ApplicationException(string.Format("Unable to retrieve initialCommunity for site: {0}", site.Location.Row + "," + site.Location.Column));
            }

            if (!SiteCohorts.InitialSitesContainsKey(key))
            {
                // Create new sitecohorts from scratch
                SiteVars.SiteCohorts[site] = new SiteCohorts(StartDate, site, initialCommunity, UsingClimateLibrary, PlugIn.InitialCommunitiesSpinup, SiteOutputNames.ContainsKey(site) ? SiteOutputNames[site] : null);
            }
            else
            {
                // Create new sitecohorts using initialcommunities data
                SiteVars.SiteCohorts[site] = new SiteCohorts(StartDate, site, initialCommunity, SiteOutputNames.ContainsKey(site) ? SiteOutputNames[site] : null);
            }
        }
        protected override void InitializeSite(ActiveSite site)//,ICommunity initialCommunity)
        {
            if (m == null)
            {
                m = new MyClock(PlugIn.ModelCore.Landscape.ActiveSiteCount);
            }

            m.Next();
            m.WriteUpdate();

            // Create new sitecohorts
            sitecohorts[site] = new SiteCohorts(StartDate, site, initialCommunity, UsingClimateLibrary, SiteOutputNames.ContainsKey(site)? SiteOutputNames[site] :null);
        }
        protected override void InitializeSite(ActiveSite site,
                                               ICommunity initialCommunity)
        {
            if (m == null)
            {
                m = new MyClock(PlugIn.ModelCore.Landscape.ActiveSiteCount);
            }

            m.Next();
            m.WriteUpdate();

            //float EstimatedTotalTime = (float)(100.0 / Percentage * (sw.ElapsedMilliseconds / 1000.0));
            //Console.Write("\rInitialization progress {0}% Elapsed time {1} Estimated total time {2}   ", System.String.Format("{0:0.00}", Percentage), Math.Round(sw.ElapsedMilliseconds / 1000F, 0), Math.Round(EstimatedTotalTime, 0));

            SiteCohorts identicalsitecohort = GetFromKey(initialCommunity.MapCode, PlugIn.ModelCore.Ecoregion[site].MapCode, site);

            // Create new sitecohorts
            if(SiteOutputNames.ContainsKey(site))
            {
                sitecohorts[site] = new SiteCohorts(StartDate,
                                                   site,
                                                   initialCommunity,
                                                    SiteOutputNames[site]);

            }
            else if (identicalsitecohort != null)
            {
                // Copy existing site data
                sitecohorts[site] = new SiteCohorts(identicalsitecohort, site);
            }
            // Create new sitecohorts
            else
            {
                sitecohorts[site] = new SiteCohorts(StartDate,
                                                    site,
                                                    initialCommunity);

            }
            CanopyLAImax[site] = sitecohorts[site].CanopyLAImax;
            WoodyDebris[site] = sitecohorts[site].WoodyDebris;
            Litter[site] = sitecohorts[site].Litter;
            SubCanopyParMaxGrowingSeason[site] = sitecohorts[site].SubCanopyParMAX;
            WaterMaxGrowingSeason[site] = sitecohorts[site].WaterMAX;
        }