Esempio n. 1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes the component with a data file.
        /// </summary>
        /// <param name="dataFile">
        /// Path to the file with initialization data.
        /// </param>
        /// <param name="startTime">
        /// Initial timestep (year): the timestep that will be passed to the
        /// first call to the component's Run method.
        /// </param>
        public void Initialize(string dataFile,
                               int startTime)
        {
            ParametersParser.SpeciesDataset = Model.Species;
            ParametersParser parser     = new ParametersParser();
            IParameters      parameters = Data.Load <IParameters>(dataFile,
                                                                  parser);

            this.timestep      = parameters.Timestep;
            this.nextTimeToRun = startTime - 1;

            this.mapNameTemplate = parameters.MapFileNames;
            this.reclassCoefs    = parameters.ReclassCoefficients;
            this.mapDefs         = parameters.ReclassMaps;

            cohorts = Model.GetSuccession <AgeCohort.ICohort>().Cohorts;
        }
Esempio n. 2
0
        //---------------------------------------------------------------------

        public override void Initialize(string dataFile,
                                        PlugIns.ICore modelCore)
        {
            this.modelCore = modelCore;

            ParametersParser.SpeciesDataset = modelCore.Species;
            ParametersParser parser     = new ParametersParser();
            IParameters      parameters = Data.Load <IParameters>(dataFile,
                                                                  parser);

            Timestep        = parameters.Timestep;
            mapNameTemplate = parameters.MapFileNames;
            mapDefs         = parameters.ReclassMaps;
            reclassCoefs    = parameters.ReclassCoefficients;

            cohorts = modelCore.SuccessionCohorts as ILandscapeCohorts;
            if (cohorts == null)
            {
                throw new ApplicationException("Error: Cohorts don't support age-cohort interface");
            }
        }