//---------------------------------------------------------------------

        public Prescription(string              name,
                            IStandRankingMethod rankingMethod,
                            ISiteSelector       siteSelector,
                            ICohortSelector     cohortSelector)
        {
            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
        }
        //---------------------------------------------------------------------

        public RepeatHarvest(string               name,
                             IStandRankingMethod  rankingMethod,
                             ISiteSelector        siteSelector,
                             ICohortSelector      cohortSelector,
                             Planting.SpeciesList speciesToPlant,
                             int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant)
        {
            this.interval = interval;
            this.spreadingSiteSelector = siteSelector as StandSpreading;
            this.harvestedStands = new List<Stand>();
        }
        //---------------------------------------------------------------------

        public SingleRepeatHarvest(string               name,
                                   IStandRankingMethod  rankingMethod,
                                   ISiteSelector        siteSelector,
                                   ICohortSelector      cohortSelector,
                                   Planting.SpeciesList speciesToPlant,
                                   ICohortSelector      additionalCohortSelector,
                                   Planting.SpeciesList additionalSpeciesToPlant,
                                   int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant, interval)
        {
            this.initialCohortSelector = cohortSelector;
            this.initialSpeciesToPlant = speciesToPlant;

            this.additionalCohortSelector = additionalCohortSelector;
            this.additionalSpeciesToPlant = additionalSpeciesToPlant;
        }
        //---------------------------------------------------------------------

        public RepeatHarvest(string               name,
                             IStandRankingMethod  rankingMethod,
                             ISiteSelector        siteSelector,
                             ICohortCutter        cohortCutter,
                             Planting.SpeciesList speciesToPlant,
                             ISiteSelector        additionalSiteSelector,
                             int                  minTimeSinceDamage,
                             bool                 preventEstablishment,
                             int                  interval)
            : base(name, rankingMethod, siteSelector, cohortCutter, speciesToPlant, minTimeSinceDamage, preventEstablishment)
        {
            this.interval = interval;
            this.spreadingSiteSelector = siteSelector as StandSpreading;
            this.additionalSiteSelector = additionalSiteSelector;
            this.harvestedStands = new List<Stand>();
        }
Ejemplo n.º 5
0
        //---------------------------------------------------------------------

        public RepeatHarvest(string name,
                             IStandRankingMethod rankingMethod,
                             ISiteSelector siteSelector,
                             ICohortCutter cohortCutter,
                             Planting.SpeciesList speciesToPlant,
                             ISiteSelector additionalSiteSelector,
                             int minTimeSinceDamage,
                             bool preventEstablishment,
                             int interval)
            : base(name, rankingMethod, siteSelector, cohortCutter, speciesToPlant, minTimeSinceDamage, preventEstablishment)
        {
            this.interval = interval;
            this.spreadingSiteSelector  = siteSelector as StandSpreading;
            this.additionalSiteSelector = additionalSiteSelector;
            this.harvestedStands        = new List <Stand>();
        }
Ejemplo n.º 6
0
        //---------------------------------------------------------------------

        public Prescription(string name,
                            IStandRankingMethod rankingMethod,
                            ISiteSelector siteSelector,
                            ICohortSelector cohortSelector,
                            Planting.SpeciesList speciesToPlant,
                            int minTimeSinceDamage,
                            bool preventEstablishment)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name                 = name;
            this.rankingMethod        = rankingMethod;
            this.siteSelector         = siteSelector;
            this.cohortSelector       = cohortSelector;
            this.speciesToPlant       = speciesToPlant;
            this.minTimeSinceDamage   = minTimeSinceDamage;
            this.preventEstablishment = preventEstablishment;
        }
        //---------------------------------------------------------------------
        public Prescription(string               name,
            IStandRankingMethod  rankingMethod,
            ISiteSelector        siteSelector,
            ICohortSelector      cohortSelector,
            Planting.SpeciesList speciesToPlant,
            int                  minTimeSinceDamage,
            bool                 preventEstablishment)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
            this.speciesToPlant = speciesToPlant;
            this.minTimeSinceDamage = minTimeSinceDamage;
            this.preventEstablishment = preventEstablishment;
        }
        //---------------------------------------------------------------------

        public SingleRepeatHarvest(string               name,
                                   IStandRankingMethod  rankingMethod,
                                   ISiteSelector        siteSelector,
                                   ICohortSelector      cohortSelector,
                                   Planting.SpeciesList speciesToPlant,
                                   ICohortSelector      additionalCohortSelector,
                                   Planting.SpeciesList additionalSpeciesToPlant,
                                   ISiteSelector        additionalSiteSelector,
                                   int                  minTimeSinceDamage,
                                   bool                 preventEstablishment,
                                   int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant,additionalSiteSelector, minTimeSinceDamage, preventEstablishment, interval)
        {
            this.initialCohortSelector = cohortSelector;
            this.initialSpeciesToPlant = speciesToPlant;

            this.additionalCohortSelector = additionalCohortSelector;
            this.additionalSpeciesToPlant = additionalSpeciesToPlant;
            this.additionalSiteSelector = additionalSiteSelector;
        }
        //---------------------------------------------------------------------

        public SingleRepeatHarvest(string name,
                                   IStandRankingMethod rankingMethod,
                                   ISiteSelector siteSelector,
                                   ICohortSelector cohortSelector,
                                   Planting.SpeciesList speciesToPlant,
                                   ICohortSelector additionalCohortSelector,
                                   Planting.SpeciesList additionalSpeciesToPlant,
                                   ISiteSelector additionalSiteSelector,
                                   int minTimeSinceDamage,
                                   bool preventEstablishment,
                                   int interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant, additionalSiteSelector, minTimeSinceDamage, preventEstablishment, interval)
        {
            this.initialCohortSelector = cohortSelector;
            this.initialSpeciesToPlant = speciesToPlant;

            this.additionalCohortSelector = additionalCohortSelector;
            this.additionalSpeciesToPlant = additionalSpeciesToPlant;
            this.additionalSiteSelector   = additionalSiteSelector;
        }
Ejemplo n.º 10
0
        //---------------------------------------------------------------------

        public Prescription(string name,
                            IStandRankingMethod rankingMethod,
                            ISiteSelector siteSelector,
                            ICohortCutter cohortCutter,
                            Planting.SpeciesList speciesToPlant,
                            int minTimeSinceDamage,
                            bool preventEstablishment)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name                       = name;
            this.rankingMethod              = rankingMethod;
            this.siteSelector               = siteSelector;
            this.cohortCutter               = cohortCutter;
            this.speciesToPlant             = speciesToPlant;
            this.minTimeSinceDamage         = minTimeSinceDamage;
            this.preventEstablishment       = preventEstablishment;
            this.isSingleRepeatStep         = false;
            this.isSingleRepeatPrescription = false;

            cohortCounts = new CohortCounts();
        }
Ejemplo n.º 11
0
        //---------------------------------------------------------------------

        public RepeatHarvest(string name,
                             IStandRankingMethod rankingMethod,
                             ISiteSelector siteSelector,
                             ICohortCutter cohortCutter,
                             Planting.SpeciesList speciesToPlant,
                             int minTimeSinceDamage,
                             bool preventEstablishment,
                             int interval,
                             int timesToRepeat = 0)
            : base(name, rankingMethod, siteSelector, cohortCutter, speciesToPlant, minTimeSinceDamage, preventEstablishment)
        {
            this.interval = interval;
            this.spreadingSiteSelector = siteSelector as StandSpreading;
            this.harvestedStands       = new List <Stand>();

            if (timesToRepeat > 1)
            {
                this.timesToRepeat = timesToRepeat;
            }
            else
            {
                this.timesToRepeat = int.MaxValue;
            }
        }
        //---------------------------------------------------------------------

        public Prescription(string               name,
                            IStandRankingMethod  rankingMethod,
                            ISiteSelector        siteSelector,
                            ICohortSelector      cohortSelector,
                            Planting.SpeciesList speciesToPlant)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
            this.speciesToPlant = speciesToPlant;
        }
        //----------------------------------------------------------------------

        //  Need to include a copy of this method because it modifies an
        //  instance member "rankingMethod" in the original version.  Bad
        //  design; the ranking method should be passed as a parameter.
        
        protected void ReadForestTypeTable(IStandRankingMethod rankingMethod)
        {
            int optionalStatements = 0;
            
            //check if this is the ForestTypeTable
            if (CurrentName == Names.ForestTypeTable) {
                ReadName(Names.ForestTypeTable);

                //fresh input variables for table
                InputVar<string> inclusionRule = new InputVar<string>("Inclusion Rule");
                InputVar<AgeRange> age_range = new InputVar<AgeRange>("Age Range", ParseAgeOrRange);
                InputVar<string> percentOfCells = new InputVar<string>("PercentOfCells");  //as a string so it can include keyword 'highest'
                InputVar<string> speciesName = new InputVar<string>("Species");
                
                
                //list for each rule- each line is a separate rule
                List<InclusionRule> rule_list = new List<InclusionRule>();              
                //keep reading until no longer in the ForestTypeTable
                while (! AtEndOfInput && !namesThatFollowForestType.Contains(CurrentName)) {
                    StringReader currentLine = new StringReader(CurrentLine);

                    //  inclusionRule column
                    ReadValue(inclusionRule, currentLine);

                    //verify inclusion rule = 'optional', 'required', or 'forbidden'
                    if (inclusionRule.Value.Actual != "Optional" && inclusionRule.Value.Actual != "Required"
                                    && inclusionRule.Value.Actual != "Forbidden") {
                        string[] ic_list = new string[]{"Valid Inclusion Rules:",
                                                                           "    Optional",
                                                                           "    Required",
                                                                           "    Forbidden"};
                        throw new InputValueException(CurrentName, CurrentName + " is not a valid inclusion rule.",
                                                  new MultiLineText(ic_list));
                    }

                    if (inclusionRule.Value.Actual == "Optional")
                        optionalStatements++;
                    
                    
                    TextReader.SkipWhitespace(currentLine);
                    ReadValue(age_range, currentLine);

                    //percentage column
                    TextReader.SkipWhitespace(currentLine);
                    ReadValue(percentOfCells, currentLine);
                    //PlugIn.ModelCore.UI.WriteLine("percentOfCells = {0}", percentOfCells.Value.String);
                    //cannot validate until parsing is done.  will do this in the inclusionRule constructor

                    //a list in case there are multiple species on this line
                    List<string> species_list = new List<string>();
                    //add each species to this rule's species list
                    TextReader.SkipWhitespace(currentLine);
                    while (currentLine.Peek() != -1) {
                        //species column (build list)
                        
                        ReadValue(speciesName, currentLine);
                        string name = speciesName.Value.String;
                        
                        ISpecies species = GetSpecies(new InputValue<string>(name, speciesName.Value.String));
                        if (species_list.Contains(species.Name))
                            throw NewParseException("The species {0} appears more than once.", species.Name);
                        species_list.Add(species.Name);

                        //species_list.Add(species.Value.String);
                        TextReader.SkipWhitespace(currentLine);
                    }

                    //add this new inclusion rule (by parameters)  to the requirement
                    rule_list.Add(new InclusionRule(inclusionRule.Value.String,
                                                    age_range.Value.Actual,
                                                    percentOfCells.Value.String,
                                                    species_list));
                    
                    GetNextLine();
                }
                //create a new requirement with this list of rules
                IRequirement inclusionRequirement = new InclusionRequirement(rule_list);
                //add this requirement to the ranking method
                rankingMethod.AddRequirement(inclusionRequirement);
            }
            
            if(optionalStatements > 0 && optionalStatements < 2)
                throw new InputValueException(CurrentName, "If there are optional statements, there must be more than one",
                                                  "ForestTypeTable");
            
        }
        //---------------------------------------------------------------------

        public Prescription(string               name,
                            IStandRankingMethod  rankingMethod,
                            ISiteSelector        siteSelector,
                            ICohortSelector      cohortSelector,
                            Planting.SpeciesList speciesToPlant,
                            int                  minTimeSinceDamage,
                            bool                 preventEstablishment)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
            this.speciesToPlant = speciesToPlant;
            this.minTimeSinceDamage = minTimeSinceDamage;
            this.preventEstablishment = preventEstablishment;

            // scan the name for LU-->{LU-name}
            const string LUmarker = "LU-->";
            int positionOfLUmarker = name.IndexOf(LUmarker);
            int positionOfLUname = positionOfLUmarker + LUmarker.Length;
            string LUname = name.Substring(positionOfLUname);
            this.landUseAfterHarvest = LandUse.LookupName(LUname);
        }
Ejemplo n.º 15
0
        private static IStandRankingMethod CopyStandRankingMethod(IStandRankingMethod standRankingMethod)
        {
            IStandRankingMethod rankingMethodCopy;

            if (standRankingMethod is EconomicRank economicRank)
            {
                var rankTable     = GetTypePrivateField <EconomicRankTable>(economicRank, "rankTable");
                var rankTableCopy = CopyEconomicRankTable(rankTable);
                rankingMethodCopy = new EconomicRank(rankTableCopy);
            }
            else if (standRankingMethod is MaxCohortAge)
            {
                rankingMethodCopy = new MaxCohortAge();
            }
            else if (standRankingMethod is RandomRank)
            {
                rankingMethodCopy = new RandomRank();
            }
            else if (standRankingMethod is RegulateAgesRank)
            {
                rankingMethodCopy = new RegulateAgesRank();
            }
            else if (standRankingMethod is FireRiskRank fireRiskRank)
            {
                var fireRiskTable     = GetTypePrivateField <FireRiskTable>(fireRiskRank, "rankTable");
                var fireRiskTableCopy = CopyFireRiskTable(fireRiskTable);
                rankingMethodCopy = new FireRiskRank(fireRiskTableCopy);
            }
            else if (standRankingMethod is TimeSinceDisturbanceRank)
            {
                rankingMethodCopy = new TimeSinceDisturbanceRank();
            }
            else
            {
                throw new Exception();
            }

            foreach (var requirement in standRankingMethod.Requirements)
            {
                if (requirement is Presalvage preSalvage)
                {
                    var preSalvageYears = GetTypePrivateField <ushort>(preSalvage, "presalvYears");
                    rankingMethodCopy.AddRequirement(new Presalvage(preSalvageYears));
                }
                else if (requirement is MinimumAge minimumAge)
                {
                    var minAge = GetTypePrivateField <ushort>(minimumAge, "minAge");
                    rankingMethodCopy.AddRequirement(new MinimumAge(minAge));
                }
                else if (requirement is MaximumAge maximumAge)
                {
                    var maxAge = GetTypePrivateField <ushort>(maximumAge, "maxAge");
                    rankingMethodCopy.AddRequirement(new MaximumAge(maxAge));
                }
                else if (requirement is TimeSinceLastFire timeSinceLastFire)
                {
                    var timeSinceFire = GetTypePrivateField <ushort>(timeSinceLastFire, "timeSinceFire");
                    rankingMethodCopy.AddRequirement(new TimeSinceLastFire(timeSinceFire));
                }
                else if (requirement is TimeSinceLastWind timeSinceLastWind)
                {
                    var timeSinceWind = GetTypePrivateField <ushort>(timeSinceLastWind, "timeSinceWind");
                    rankingMethodCopy.AddRequirement(new TimeSinceLastWind(timeSinceWind));
                }
                else if (requirement is StandAdjacency standAdjacency)
                {
                    var time = GetTypePrivateField <ushort>(standAdjacency, "time");
                    var type = GetTypePrivateField <string>(standAdjacency, "type");
                    rankingMethodCopy.AddRequirement(new StandAdjacency(time, type, standAdjacency.SetAside));
                }
                else if (requirement is SpatialArrangement spatialArrangement)
                {
                    var minAge = GetTypePrivateField <ushort>(spatialArrangement, "minAge");
                    rankingMethodCopy.AddRequirement(new SpatialArrangement(minAge));
                }
                else if (requirement is MinTimeSinceLastHarvest minTimeSinceLastHarvest)
                {
                    var minTime = GetTypePrivateField <ushort>(minTimeSinceLastHarvest, "minTime");
                    rankingMethodCopy.AddRequirement(new MinTimeSinceLastHarvest(minTime));
                }
                else if (requirement is InclusionRequirement inclusionRequirement)
                {
                    var ruleList     = GetTypePrivateField <List <InclusionRule> >(inclusionRequirement, "rule_list");
                    var ruleListCopy = CopyInclusionRuleList(ruleList);
                    rankingMethodCopy.AddRequirement(new InclusionRequirement(ruleListCopy));
                }
            }

            return(rankingMethodCopy);
        }
Ejemplo n.º 16
0
        //---------------------------------------------------------------------

        protected IStandRankingMethod ReadRankingMethod()
        {
            //1. read which ranking method is chosen- eg. Random and MaxCohortAge
            //2. check for optional ranking requirements- eg. minimumAge and maximumAge
            //3. form rankingMethod and return it.

            InputVar <string> rankingName = new InputVar <string>("StandRanking");

            ReadVar(rankingName);

            IStandRankingMethod rankingMethod;

            if (rankingName.Value.Actual == "Economic")
            {
                rankingMethod = new EconomicRank(ReadEconomicRankTable());
            }
            else if (rankingName.Value.Actual == "MaxCohortAge")
            {
                rankingMethod = new MaxCohortAge();
            }
            else if (rankingName.Value.Actual == "Random")
            {
                rankingMethod = new RandomRank();
            }
            else if (rankingName.Value.Actual == "RegulateAges")
            {
                rankingMethod = new RegulateAgesRank();
            }
            else if (rankingName.Value.Actual == "FireHazard")
            {
                rankingMethod = new FireRiskRank(ReadFireRiskTable());
            }

            ////list of ranking methods which have not been implemented yet
            //else if ((rankingName.Value.Actual == "SpeciesBiomass") ||
            //        (rankingName.Value.Actual == "TotalBiomass")) {
            //    throw new InputValueException(rankingName.Value.String,
            //                                  rankingName.Value.String + " is not implemented yet");
            //}

            else
            {
                string[] methodList = new string[] { "Stand ranking methods:",
                                                     "  Economic",
                                                     "  MaxCohortAge",
                                                     "  Random",
                                                     "  RegulateAges",
                                                     "  FireRisk" };
                throw new InputValueException(rankingName.Value.String,
                                              rankingName.Value.String + " is not a valid stand ranking",
                                              new MultiLineText(methodList));
            }

            //  Read optional ranking requirements

            ushort?           minAge     = null;
            InputVar <ushort> minimumAge = new InputVar <ushort>("MinimumAge");

            if (ReadOptionalVar(minimumAge))
            {
                //get minAge
                minAge = minimumAge.Value.Actual;
                //add the minimumAge ranking requirement to this ranking method.
                rankingMethod.AddRequirement(new MinimumAge(minAge.Value));
            }

            InputVar <ushort> maximumAge = new InputVar <ushort>("MaximumAge");

            if (ReadOptionalVar(maximumAge))
            {
                //get maxAge
                ushort maxAge = maximumAge.Value.Actual;
                //throw exception if maxAge < minAge
                if (minAge.HasValue && maxAge < minAge)
                {
                    throw new InputValueException(maximumAge.Value.String,
                                                  "{0} is < minimum age ({1})",
                                                  maximumAge.Value.String,
                                                  minimumAge.Value.String);
                }
                //add the maximumAge ranking requirement to this ranking method.
                rankingMethod.AddRequirement(new MaximumAge(maxAge));
            }

            //stand adjacency variables and constraints
            InputVar <ushort> standAdjacency            = new InputVar <ushort>("StandAdjacency");
            InputVar <string> adjacencyType             = new InputVar <string>("AdjacencyType");
            InputVar <ushort> adjacencyNeighborSetAside = new InputVar <ushort>("AdjacencyNeighborSetAside");

            //if stand-adjacency is defined, check flags
            if (ReadOptionalVar(standAdjacency))
            {
                //get adjacency-type
                ushort adjacency = standAdjacency.Value.Actual;
                ReadVar(adjacencyType);

                if (adjacencyType.Value.String != "StandAge" && adjacencyType.Value.String != "MinimumTimeSinceLastHarvest")
                {
                    string[] methodList = new string[] { "AdjacencyType methods:",
                                                         "    StandAge",
                                                         "    TimeSinceLastHarvested" };
                    throw new InputValueException(adjacencyType.Value.String,
                                                  adjacencyType.Value.String + " is not a valid site selection method",
                                                  new MultiLineText(methodList));
                }
                string ad_type = adjacencyType.Value.String;

                //get set-aside var if defined
                ushort set_aside = 0;
                if (ReadOptionalVar(adjacencyNeighborSetAside))
                {
                    //Model.Core.UI.WriteLine("adjacencyNeighborSetAside = {0}", adjacencyNeighborSetAside.Value.Actual);
                    set_aside = adjacencyNeighborSetAside.Value.Actual;
                }
                //add stand-adjacency to list of ranking requirements
                rankingMethod.AddRequirement(new StandAdjacency(adjacency, ad_type, set_aside));
            }


            InputVar <ushort> spatialArrangement = new InputVar <ushort>("SpatialArrangement");

            if (ReadOptionalVar(spatialArrangement))
            {
                //get minimum age requirement
                ushort s_minAge = spatialArrangement.Value.Actual;
                //add ranking requirement for neighbor stands to be at least of minimum age (defined by s_minAge)
                rankingMethod.AddRequirement(new SpatialArrangement(s_minAge));
            }

            InputVar <ushort> minimumTimeSinceLastHarvest = new InputVar <ushort>("MinimumTimeSinceLastHarvest");

            if (ReadOptionalVar(minimumTimeSinceLastHarvest))
            {
                //get minimum time requirement
                ushort min_time = minimumTimeSinceLastHarvest.Value.Actual;
                //add requirement for this stand to have not been harvested within the minimum
                //time ranking requirement specified (defined by min_time)
                rankingMethod.AddRequirement(new MinTimeSinceLastHarvest(min_time));
            }

            return(rankingMethod);
        }
Ejemplo n.º 17
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Reads 0 or more prescriptions from text input.
        /// </summary>
        protected void ReadPrescriptions(List <Prescription> prescriptions,
                                         int harvestTimestep)
        {
            Dictionary <string, int> lineNumbers = new Dictionary <string, int>();

            InputVar <int> singleRepeat   = new InputVar <int>(Names.SingleRepeat);
            InputVar <int> multipleRepeat = new InputVar <int>(Names.MultipleRepeat);

            int nameLineNumber = LineNumber;
            InputVar <string> prescriptionName = new InputVar <string>(Names.Prescription);

            while (ReadOptionalVar(prescriptionName))
            {
                string name = prescriptionName.Value.Actual;
                int    lineNumber;
                if (lineNumbers.TryGetValue(name, out lineNumber))
                {
                    throw new InputValueException(prescriptionName.Value.String,
                                                  "The name {0} was previously used on line {1}",
                                                  prescriptionName.Value.String, lineNumber);
                }
                else
                {
                    lineNumbers[name] = nameLineNumber;
                }

                //get ranking method
                rankingMethod = ReadRankingMethod();

                //get stand-harvesting requirements, will modify rankingMethod variable
                ReadForestTypeTable();

                //get site selection method
                ISiteSelector siteSelector = ReadSiteSelector();

                //get the minTimeSinceDamage
                int            minTimeSinceDamage    = 0;
                InputVar <int> minTimeSinceDamageVar = new InputVar <int>("MinTimeSinceDamage");
                if (ReadOptionalVar(minTimeSinceDamageVar))
                {
                    minTimeSinceDamage = minTimeSinceDamageVar.Value;
                }

                bool preventEstablishment = ReadPreventEstablishment();

                ICohortSelector cohortSelector = ReadCohortSelector(false);
                ICohortCutter   cohortCutter   = CreateCohortCutter(cohortSelector);

                Planting.SpeciesList speciesToPlant = ReadSpeciesToPlant();

                //  Repeat harvest?
                int repeatParamLineNumber = LineNumber;
                if (ReadOptionalVar(singleRepeat))
                {
                    int interval = ValidateRepeatInterval(singleRepeat.Value,
                                                          repeatParamLineNumber,
                                                          harvestTimestep);
                    ICohortSelector      additionalCohortSelector = ReadCohortSelector(true);
                    ICohortCutter        additionalCohortCutter   = CreateCohortCutter(additionalCohortSelector);
                    Planting.SpeciesList additionalSpeciesToPlant = ReadSpeciesToPlant();
                    ISiteSelector        additionalSiteSelector   = new CompleteStand();
                    prescriptions.Add(new SingleRepeatHarvest(name,
                                                              rankingMethod,
                                                              siteSelector,
                                                              cohortCutter,
                                                              speciesToPlant,
                                                              additionalCohortCutter,
                                                              additionalSpeciesToPlant,
                                                              additionalSiteSelector,
                                                              minTimeSinceDamage,
                                                              preventEstablishment,
                                                              interval));
                }
                else if (ReadOptionalVar(multipleRepeat))
                {
                    int interval = ValidateRepeatInterval(multipleRepeat.Value,
                                                          repeatParamLineNumber,
                                                          harvestTimestep);
                    ISiteSelector additionalSiteSelector = new CompleteStand();
                    prescriptions.Add(new RepeatHarvest(name,
                                                        rankingMethod,
                                                        siteSelector,
                                                        cohortCutter,
                                                        speciesToPlant,
                                                        additionalSiteSelector,
                                                        minTimeSinceDamage,
                                                        preventEstablishment,
                                                        interval));
                }
                else
                {
                    prescriptions.Add(new Prescription(name,
                                                       rankingMethod,
                                                       siteSelector,
                                                       cohortCutter,
                                                       speciesToPlant,
                                                       minTimeSinceDamage,
                                                       preventEstablishment));
                }
            }
        }