Beispiel #1
0
        /// <summary>Sow the crop with the specified parameters.</summary>
        /// <param name="cultivar">The cultivar.</param>
        /// <param name="population">The population.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="rowSpacing">The row spacing.</param>
        /// <param name="maxCover">The maximum cover.</param>
        /// <param name="budNumber">The bud number.</param>
        /// <param name="rowConfig">SkipRow configuration.</param>
        public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1, double rowConfig = 1)
        {
            SowingDate = Clock.Today;

            SowingData            = new SowPlant2Type();
            SowingData.Plant      = this;
            SowingData.Population = population;
            SowingData.Depth      = depth;
            SowingData.Cultivar   = cultivar;
            SowingData.MaxCover   = maxCover;
            SowingData.BudNumber  = budNumber;
            SowingData.RowSpacing = rowSpacing;
            SowingData.SkipRow    = rowConfig;
            this.Population       = population;

            // Find cultivar and apply cultivar overrides.
            cultivarDefinition = PMF.Cultivar.Find(Cultivars, SowingData.Cultivar);
            cultivarDefinition.Apply(this);


            // Invoke an AboutToSow event.
            if (Sowing != null)
            {
                Sowing.Invoke(this, new EventArgs());
            }

            // Invoke a sowing event.
            if (PlantSowing != null)
            {
                PlantSowing.Invoke(this, SowingData);
            }

            Summary.WriteMessage(this, string.Format("A crop of " + CropType + " (cultivar = " + cultivar + ") was sown today at a population of " + Population + " plants/m2 with " + budNumber + " buds per plant at a row spacing of " + rowSpacing + " and a depth of " + depth + " mm"));
        }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Plant()
        {
            SowingData = new SowPlant2Type();
            IsAlive    = false;

            string photosyntheticPathway = (string)Apsim.Get(this, "Leaf.Photosynthesis.FCO2.PhotosyntheticPathway");

            IsC4       = photosyntheticPathway != null && photosyntheticPathway == "C4";
            Legumosity = 0;
        }
Beispiel #3
0
 private void OnPlantSowing(object sender, SowPlant2Type Sow)
 {
     if (Sow.Plant == Plant)
     {
         Clear();
         if (Sow.MaxCover <= 0.0)
         {
             throw new Exception("MaxCover must exceed zero in a Sow event.");
         }
         PrimaryBudNo  = Sow.BudNumber;
         TotalStemPopn = MainStemPopn;
     }
 }
        virtual protected void OnPlantSowing(object sender, SowPlant2Type data)
        {
            List <IArbitration> organsToArbitrate = new List <IArbitration>();

            foreach (IOrgan organ in plant.Organs)
            {
                if (organ is IArbitration)
                {
                    organsToArbitrate.Add(organ as IArbitration);
                }
            }

            Organs = organsToArbitrate;
            DM     = new BiomassArbitrationType("DM", Organs);
            N      = new BiomassArbitrationType("N", Organs);
        }
        private void OnPlantSowing(object sender, SowPlant2Type data)
        {
            if (data.Plant == Plant)
            {
                List <IArbitration> organsToArbitrate = new List <IArbitration>();
                foreach (IOrgan organ in Plant.Organs)
                {
                    if (organ is IArbitration)
                    {
                        organsToArbitrate.Add(organ as IArbitration);
                    }
                }

                Organs = organsToArbitrate.ToArray();
            }
        }
Beispiel #6
0
 private void OnPlantSowing(object sender, SowPlant2Type Sow)
 {
     if (Sow.Plant == Plant)
     {
         Clear();
         if (Sow.MaxCover <= 0.0)
         {
             throw new Exception("MaxCover must exceed zero in a Sow event.");
         }
         PrimaryBudNo  = Sow.BudNumber;
         TotalStemPopn = Sow.Population * PrimaryBudNo;
         //MainStemFinalNodeNo = MainStemFinalNodeNumber.Value;
         //if (MainStemFinalNodeNumber is MainStemFinalNodeNumberFunction)
         //    _MainStemFinalNodeNo = (MainStemFinalNodeNumber as MainStemFinalNodeNumberFunction).MaximumMainStemNodeNumber;
         //else
         //    _MainStemFinalNodeNo = MainStemFinalNodeNumber.Value;
         //MaximumNodeNumber = (int)_MainStemFinalNodeNo;
         //_Height = HeightModel.Value;
     }
 }
Beispiel #7
0
        virtual protected void OnPlantSowing(object sender, SowPlant2Type data)
        {
            List <IArbitration>    organsToArbitrate = new List <IArbitration>();
            List <IHasWaterDemand> Waterdemands      = new List <IHasWaterDemand>();

            foreach (Model Can in Apsim.FindAll(Plant, typeof(IHasWaterDemand)))
            {
                Waterdemands.Add(Can as IHasWaterDemand);
            }

            foreach (IOrgan organ in Plant.Organs)
            {
                if (organ is IArbitration)
                {
                    organsToArbitrate.Add(organ as IArbitration);
                }
            }


            Organs       = organsToArbitrate;
            WaterDemands = Waterdemands;
            DM           = new BiomassArbitrationType("DM", Organs);
            N            = new BiomassArbitrationType("N", Organs);
        }
Beispiel #8
0
 private void OnPlantSowing(object sender, SowPlant2Type Sow)
 {
     if (Sow.Plant == Plant)
     {
         Clear();
         if (Sow.MaxCover <= 0.0)
             throw new Exception("MaxCover must exceed zero in a Sow event.");
         PrimaryBudNo = Sow.BudNumber;
         TotalStemPopn = Sow.Population * PrimaryBudNo;
         if (MainStemFinalNodeNumber is MainStemFinalNodeNumberFunction)
             _MainStemFinalNodeNo = (MainStemFinalNodeNumber as MainStemFinalNodeNumberFunction).MaximumMainStemNodeNumber;
         else
             _MainStemFinalNodeNo = MainStemFinalNodeNumber.Value;
         MaximumNodeNumber = (int)_MainStemFinalNodeNo;
         _Height = HeightModel.Value;
     }
 }
Beispiel #9
0
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     SowingData = null;
     Population = 0;
 }
Beispiel #10
0
        private void OnPlantSowing(object sender, SowPlant2Type data)
        {
            if (data.Plant == Plant)
            {
                List<IArbitration> organsToArbitrate = new List<IArbitration>();

                foreach (IOrgan organ in Plant.Organs)
                    if (organ is IArbitration)
                        organsToArbitrate.Add(organ as IArbitration);

                Organs = organsToArbitrate.ToArray();
            }
        }
Beispiel #11
0
 private void OnPlantSowing(object sender, SowPlant2Type Sow)
 {
     if (Sow.Plant == Plant)
     {
         Clear();
         if (Sow.MaxCover <= 0.0)
             throw new Exception("MaxCover must exceed zero in a Sow event.");
         PrimaryBudNo = Sow.BudNumber;
         TotalStemPopn = MainStemPopn;
     }
 }
Beispiel #12
0
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     SowingData      = new SowPlant2Type();
     plantPopulation = 0.0;
     IsAlive         = false;
 }
Beispiel #13
0
        /// <summary>Sow the crop with the specified parameters.</summary>
        /// <param name="cultivar">The cultivar.</param>
        /// <param name="population">The population.</param>
        /// <param name="depth">The depth mm.</param>
        /// <param name="rowSpacing">The row spacing mm.</param>
        /// <param name="maxCover">The maximum cover.</param>
        /// <param name="budNumber">The bud number.</param>
        /// <param name="rowConfig">SkipRow configuration.</param>
        public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1, double rowConfig = 0)
        {
            SowingDate = Clock.Today;

            SowingData            = new SowPlant2Type();
            SowingData.Plant      = this;
            SowingData.Population = population;
            SowingData.Depth      = depth;
            SowingData.Cultivar   = cultivar;
            SowingData.MaxCover   = maxCover;
            SowingData.BudNumber  = budNumber;
            SowingData.RowSpacing = rowSpacing;
            SowingData.SkipType   = rowConfig;

            if (rowConfig == 0)
            {
                // No skip row
                SowingData.SkipPlant = 1.0;
                SowingData.SkipRow   = 0.0;
            }
            if (rowConfig == 1)
            {
                // Alternate rows (plant 1 – skip 1)
                SowingData.SkipPlant = 1.0;
                SowingData.SkipRow   = 1.0;
            }
            if (rowConfig == 2)
            {
                // Planting two rows and skipping one row (plant 2 – skip 1)
                SowingData.SkipPlant = 2.0;
                SowingData.SkipRow   = 1.0;
            }
            if (rowConfig == 3)
            {
                // Alternate pairs of rows (plant 2 – skip 2)
                SowingData.SkipPlant = 2.0;
                SowingData.SkipRow   = 2.0;
            }

            // Adjusting number of plant per meter in each row
            SowingData.SkipDensityScale = 1.0 + SowingData.SkipRow / SowingData.SkipPlant;

            IsAlive = true;

            this.Population = population;

            // Find cultivar and apply cultivar overrides.
            cultivarDefinition = PMF.Cultivar.Find(Cultivars, SowingData.Cultivar);
            cultivarDefinition.Apply(this);


            // Invoke an AboutToSow event.
            if (Sowing != null)
            {
                Sowing.Invoke(this, new EventArgs());
            }

            // Invoke a sowing event.
            if (PlantSowing != null)
            {
                PlantSowing.Invoke(this, SowingData);
            }

            Summary.WriteMessage(this, string.Format("A crop of " + CropType + " (cultivar = " + cultivar + ") was sown today at a population of " + Population + " plants/m2 with " + budNumber + " buds per plant at a row spacing of " + rowSpacing + " and a depth of " + depth + " mm"));
        }
Beispiel #14
0
        /// <summary>Sow the crop with the specified parameters.</summary>
        /// <param name="cultivar">The cultivar.</param>
        /// <param name="population">The population.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="rowSpacing">The row spacing.</param>
        /// <param name="maxCover">The maximum cover.</param>
        /// <param name="budNumber">The bud number.</param>
        public void Sow(string cultivar, double population, double depth, double rowSpacing, double maxCover = 1, double budNumber = 1)
        {
            SowingDate = Clock.Today;

            SowingData = new SowPlant2Type();
            SowingData.Plant = this;
            SowingData.Population = population;
            SowingData.Depth = depth;
            SowingData.Cultivar = cultivar;
            SowingData.MaxCover = maxCover;
            SowingData.BudNumber = budNumber;
            SowingData.RowSpacing = rowSpacing;
            this.Population = population;

            // Find cultivar and apply cultivar overrides.
            cultivarDefinition = PMF.Cultivar.Find(Cultivars, SowingData.Cultivar);
            cultivarDefinition.Apply(this);

            // Invoke an AboutToSow event.
            if (Sowing != null)
                Sowing.Invoke(this, new EventArgs());

            // Invoke a sowing event.
            if (PlantSowing != null)
                PlantSowing.Invoke(this, SowingData);

            if (Phenology == null)
                SendEmergingEvent();

            Summary.WriteMessage(this, string.Format("A crop of " + CropType + " (cultivar = " + cultivar + ") was sown today at a population of " + Population + " plants/m2 with " + budNumber + " buds per plant at a row spacing of " + rowSpacing + " and a depth of " + depth + " mm"));
        }