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

        public override void Initialize()
        {
            //event_id = 1;
            HarvestMgmtLib.SiteVars.GetExternalVars();
            MetadataHandler.InitializeMetadata(parameters.Timestep, parameters.PrescriptionMapNames, parameters.EventLog, parameters.SummaryLog);
            SiteVars.Initialize();
            Timestep        = parameters.Timestep;
            managementAreas = parameters.ManagementAreas;
            ModelCore.UI.WriteLine("   Reading management-area map {0} ...", parameters.ManagementAreaMap);
            ManagementAreas.ReadMap(parameters.ManagementAreaMap, managementAreas);

            ModelCore.UI.WriteLine("   Reading stand map {0} ...", parameters.StandMap);
            Stands.ReadMap(parameters.StandMap);

            //finish initializing SiteVars
            HarvestMgmtLib.SiteVars.GetExternalVars();

            foreach (ManagementArea mgmtArea in managementAreas)
            {
                mgmtArea.FinishInitialization();
            }

            prescriptionMaps = new PrescriptionMaps(parameters.PrescriptionMapNames);
            nameTemplate     = parameters.PrescriptionMapNames;

            if (parameters.BiomassMapNames != null)
            {
                biomassMaps = new BiomassMaps(parameters.BiomassMapNames);
            }
        }
示例#2
0
        //---------------------------------------------------------------------

        public override void Initialize()
        {
            //initialize event id
            event_id = 1;

            MetadataHandler.InitializeMetadata(parameters.Timestep, parameters.PrescriptionMapNames, parameters.EventLog, parameters.SummaryLog);
            Timestep        = parameters.Timestep;
            managementAreas = parameters.ManagementAreas;
            PlugIn.ModelCore.UI.WriteLine("   Reading management-area map {0} ...", parameters.ManagementAreaMap);
            ManagementAreas.ReadMap(parameters.ManagementAreaMap, managementAreas);

            //readMap reads the stand map and adds all the stands to a management area
            PlugIn.ModelCore.UI.WriteLine("   Reading stand map {0} ...", parameters.StandMap);
            Stands.ReadMap(parameters.StandMap);

            //finish initializing SiteVars
            SiteVars.GetExternalVars();

            //finish each managementArea's initialization
            //after reading the stand map, finish the initializations
            foreach (ManagementArea mgmtArea in managementAreas)
            {
                mgmtArea.FinishInitialization();
            }

            prescriptionMaps = new PrescriptionMaps(parameters.PrescriptionMapNames);
        }
        //---------------------------------------------------------------------

        public override void Initialize()
        {
            //initialize event id
            event_id = 1;
            Timestep = parameters.Timestep;
            managementAreas = parameters.ManagementAreas;
            PlugIn.ModelCore.UI.WriteLine("   Reading management-area map {0} ...", parameters.ManagementAreaMap);
            ManagementAreas.ReadMap(parameters.ManagementAreaMap, managementAreas);

            //readMap reads the stand map and adds all the stands to a management area
            PlugIn.ModelCore.UI.WriteLine("   Reading stand map {0} ...", parameters.StandMap);
            Stands.ReadMap(parameters.StandMap);

            //finish each managementArea's initialization
            //after reading the stand map, finish the initializations
            foreach (ManagementArea mgmtArea in managementAreas)
                mgmtArea.FinishInitialization();

            prescriptionMaps = new PrescriptionMaps(parameters.PrescriptionMapNames);

            //open log file and write header
            PlugIn.ModelCore.UI.WriteLine("   Opening harvest log file \"{0}\" ...", parameters.EventLog);

            try {
                log = Landis.Data.CreateTextFile(parameters.EventLog);
            }
            catch (Exception err) {
                string mesg = string.Format("{0}", err.Message);
                throw new System.ApplicationException(mesg);
            }
            log.AutoFlush = true;
            
            //include a column for each species in the species dictionary
            string species_header_names = "";
            int i = 0;
            for (i = 0; i < PlugIn.ModelCore.Species.Count; i++) {
                species_header_names += PlugIn.ModelCore.Species[i].Name + ",";
            }

            log.WriteLine("Time,ManagementArea,Prescription,Stand,EventId,StandAge,StandRank,NumberOfSites,HarvestedSites,CohortsKilled,{0}", species_header_names);

            PlugIn.ModelCore.UI.WriteLine("   Opening summary harvest log file \"{0}\" ...", parameters.SummaryLog);

            try {
                summaryLog = Landis.Data.CreateTextFile(parameters.SummaryLog);
            }
            catch (Exception err) {
                string mesg = string.Format("{0}", err.Message);
                throw new System.ApplicationException(mesg);
            }
            summaryLog.AutoFlush = true;

            summaryLog.WriteLine("Time,ManagementArea,Prescription,HarvestedSites,{0}", species_header_names);


        }