コード例 #1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Checks to see if the biomass parameters should be updated for the
        /// current time step.
        /// </summary>
        public static void CheckForUpdate()
        {
            while (nextUpdate != null && nextUpdate.Year <= PlugIn.ModelCore.CurrentTime) {
                //  Update various biomass parameters
                //Reproduction.ChangeEstablishProbabilities(Util.ToArray<double>(nextUpdate.Parameters.EstablishProbability));

                //Update Input Data:
                SpeciesData.ChangeParameters(nextUpdate.Parameters);
                EcoregionData.ChangeParameters(nextUpdate.Parameters);

                PlugIn.ModelCore.UI.WriteLine("   Updated biomass parameters for climate change");

                indexOfNextUpdate++;
                if (indexOfNextUpdate < parameterUpdates.Count)
                    nextUpdate = parameterUpdates[indexOfNextUpdate];
                else
                    nextUpdate = null;
            }
        }
コード例 #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes the module.
        /// </summary>
        /// <param name="parameterUpdates">
        /// The list of parameter updates.  The year and the file for each
        /// update has been specified.
        /// </param>
        /// <remarks>
        /// The file for each update is parsed for the set of biomass
        /// parameters.
        /// </remarks>
        public static void Initialize(List<ParametersUpdate> parameterUpdates)
        {
            Module.parameterUpdates = parameterUpdates;
            if (parameterUpdates.Count > 0) {
                PlugIn.ModelCore.UI.WriteLine("   Loading biomass parameters for climate change:");
                ParametersParser parser = new ParametersParser();
                foreach (ParametersUpdate update in parameterUpdates) {
                    update.LoadParameters(parser);
                    PlugIn.ModelCore.UI.WriteLine("  Read parameters for year {0} from file \"{1}\"",
                                 update.Year, update.File);
                }

                indexOfNextUpdate = 0;
                nextUpdate = parameterUpdates[indexOfNextUpdate];
            }
            else {
                nextUpdate = null;
            }
        }