Esempio n. 1
0
 /// <summary>Sets the dry matter potential allocation.</summary>
 /// <param name="dryMatter">The potential amount of drymatter allocation</param>
 public void SetDryMatterPotentialAllocation(BiomassPoolType dryMatter)
 {
     potentialMetabolicDMAllocation   = dryMatter.Metabolic;
     potentialStructuralDMAllocation  = dryMatter.Structural;
     potentialDMAllocating            = dryMatter.Structural + dryMatter.Metabolic;
     potentialDMAllocation.Structural = dryMatter.Structural;
     potentialDMAllocation.Metabolic  = dryMatter.Metabolic;
     potentialDMAllocation.Storage    = dryMatter.Storage;
 }
Esempio n. 2
0
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     DMDemand = new BiomassPoolType();
     NDemand  = new BiomassPoolType();
     DMSupply = new BiomassSupplyType();
     NSupply  = new BiomassSupplyType();
     potentialDMAllocation = new BiomassPoolType();
     Detached = new Biomass();
     Clear();
 }
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     Allocated = new PMF.Biomass();
     Senesced  = new Biomass();
     Detached  = new Biomass();
     Removed   = new Biomass();
     NDemand   = new BiomassPoolType();
     DMDemand  = new BiomassPoolType();
     NSupply   = new BiomassSupplyType();
     DMSupply  = new BiomassSupplyType();
 }
Esempio n. 4
0
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     DMDemand = new BiomassPoolType();
     DMDemandPriorityFactor            = new BiomassPoolType();
     DMDemandPriorityFactor.Structural = 1.0;
     DMDemandPriorityFactor.Metabolic  = 1.0;
     DMDemandPriorityFactor.Storage    = 1.0;
     NDemand  = new BiomassPoolType();
     DMSupply = new BiomassSupplyType();
     NSupply  = new BiomassSupplyType();
     potentialDMAllocation = new BiomassPoolType();
     Detached = new Biomass();
     Clear();
 }
Esempio n. 5
0
 /// <summary>Sets the dry matter potential allocation.</summary>
 public void SetDryMatterPotentialAllocation(BiomassPoolType dryMatter)
 {
     if (DMDemand.Structural == 0)
     {
         if (dryMatter.Structural < 0.000000000001)
         {
         }                                             //All OK
         else
         {
             throw new Exception("Invalid allocation of potential DM in" + Name);
         }
     }
     potentialDMAllocation.Structural = dryMatter.Structural;
     // PotentialDailyGrowth = value.Structural;
 }
Esempio n. 6
0
 /// <summary>Clears this instance.</summary>
 private void Clear()
 {
     Live     = new Biomass();
     Dead     = new Biomass();
     DMDemand = new BiomassPoolType();
     NDemand  = new BiomassPoolType();
     DMSupply = new BiomassSupplyType();
     NSupply  = new BiomassSupplyType();
     potentialDMAllocation = new BiomassPoolType();
     Allocated             = new Biomass();
     Senesced          = new Biomass();
     Detached          = new Biomass();
     Removed           = new Biomass();
     GrowthRespiration = 0;
 }
Esempio n. 7
0
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     Live                  = new Biomass();
     Dead                  = new Biomass();
     StartLive             = new Biomass();
     DMDemand              = new BiomassPoolType();
     NDemand               = new BiomassPoolType();
     DMSupply              = new BiomassSupplyType();
     NSupply               = new BiomassSupplyType();
     potentialDMAllocation = new BiomassPoolType();
     Allocated             = new Biomass();
     Senesced              = new Biomass();
     Detached              = new Biomass();
     Removed               = new Biomass();
 }
Esempio n. 8
0
        /// <summary>Sets the dry matter potential allocation.</summary>
        public void SetDryMatterPotentialAllocation(BiomassPoolType dryMatter)
        {
            if (PlantZone.WaterUptake == null)
            {
                throw new Exception("No water and N uptakes supplied to root. Is Soil Arbitrator included in the simulation?");
            }

            if (PlantZone.Depth <= 0)
            {
                return; //cannot allocate growth where no length
            }
            if (DMDemand.Structural == 0 && dryMatter.Structural > 0.000000000001)
            {
                throw new Exception("Invalid allocation of potential DM in" + Name);
            }


            double TotalRAw = 0;

            foreach (ZoneState Z in Zones)
            {
                TotalRAw += MathUtilities.Sum(Z.CalculateRootActivityValues());
            }

            if (TotalRAw == 0 && dryMatter.Structural > 0)
            {
                throw new Exception("Error trying to partition potential root biomass");
            }

            if (TotalRAw > 0)
            {
                foreach (ZoneState Z in Zones)
                {
                    double[] RAw = Z.CalculateRootActivityValues();
                    Z.PotentialDMAllocated = new double[Z.soil.Thickness.Length];

                    for (int layer = 0; layer < Z.soil.Thickness.Length; layer++)
                    {
                        Z.PotentialDMAllocated[layer] = dryMatter.Structural * RAw[layer] / TotalRAw;
                    }
                }
                needToRecalculateLiveDead = true;
            }

            potentialDMAllocation.Structural = dryMatter.Structural;
            potentialDMAllocation.Metabolic  = dryMatter.Metabolic;
            potentialDMAllocation.Storage    = dryMatter.Storage;
        }
Esempio n. 9
0
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     Live     = new Biomass();
     Dead     = new Biomass();
     DMDemand = new BiomassPoolType();
     DMDemandPriorityFactor            = new BiomassPoolType();
     DMDemandPriorityFactor.Structural = 1.0;
     DMDemandPriorityFactor.Metabolic  = 1.0;
     DMDemandPriorityFactor.Storage    = 1.0;
     NDemand   = new BiomassPoolType();
     DMSupply  = new BiomassSupplyType();
     NSupply   = new BiomassSupplyType();
     Allocated = new Biomass();
     Senesced  = new Biomass();
     Detached  = new Biomass();
     Removed   = new Biomass();
 }
Esempio n. 10
0
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     startLive             = new Biomass();
     DMDemand              = new BiomassPoolType();
     NDemand               = new BiomassPoolType();
     DMSupply              = new BiomassSupplyType();
     NSupply               = new BiomassSupplyType();
     potentialDMAllocation = new BiomassPoolType();
     Allocated             = new Biomass();
     Senesced              = new Biomass();
     Detached              = new Biomass();
     Removed               = new Biomass();
     Height          = 0.0;
     LAI             = 0.0;
     leafInitialised = false;
     Clear();
 }
Esempio n. 11
0
 protected void OnSimulationCommencing(object sender, EventArgs e)
 {
     Live      = new Biomass();
     Dead      = new Biomass();
     startLive = new Biomass();
     DMDemand  = new BiomassPoolType();
     DMDemandPriorityFactor            = new BiomassPoolType();
     DMDemandPriorityFactor.Structural = 1.0;
     DMDemandPriorityFactor.Metabolic  = 1.0;
     DMDemandPriorityFactor.Storage    = 1.0;
     NDemand  = new BiomassPoolType();
     DMSupply = new BiomassSupplyType();
     NSupply  = new BiomassSupplyType();
     potentialDMAllocation = new BiomassPoolType();
     Allocated             = new Biomass();
     Senesced        = new Biomass();
     Detached        = new Biomass();
     Removed         = new Biomass();
     Height          = 0.0;
     LAI             = 0.0;
     leafInitialised = false;
 }
Esempio n. 12
0
        /// <summary>Does the dm setup.</summary>
        /// <param name="Organs">The organs.</param>
        /// <param name="Type">The arbitration type</param>
        virtual public void DoSetup(string Type, IArbitration[] Organs)
        {
            //Creat Drymatter variable class
            Resize(Organs.Length);
            BiomassType = Type;

            // GET INITIAL STATE VARIABLES FOR MASS BALANCE CHECKS
            Start = 0;
            // GET SUPPLIES AND CALCULATE TOTAL
            for (int i = 0; i < Organs.Length; i++)
            {
                BiomassSupplyType Supply = new BiomassSupplyType();
                if (Type == "DM")
                {
                    Supply = Organs[i].DMSupply;
                }
                else
                {
                    Supply = Organs[i].NSupply;
                }

                if (Type == "DM")
                {
                    if (MathUtilities.IsLessThan(Supply.Fixation + Supply.Reallocation + Supply.Retranslocation + Supply.Uptake, 0))
                    {
                        throw new Exception(Organs[i].Name + " is returning a negative " + Type + " supply.  Check your parameterisation");
                    }
                }
                ReallocationSupply[i] = Supply.Reallocation;
                if (Type == "DM")
                {
                    UptakeSupply[i] = Supply.Uptake;  // Equivalent for N done elsewhere - not sure why NIH
                }
                FixationSupply[i]        = Supply.Fixation;
                RetranslocationSupply[i] = Supply.Retranslocation;
                if (Type == "DM")
                {
                    Start += Organs[i].Total.Wt;
                }
                else
                {
                    Start += Organs[i].Total.N;
                }
            }

            // SET OTHER ORGAN VARIABLES AND CALCULATE TOTALS
            for (int i = 0; i < Organs.Length; i++)
            {
                BiomassPoolType Demand = new BiomassPoolType();
                if (Type == "DM")
                {
                    Demand = Organs[i].DMDemand;
                }
                else
                {
                    Demand = Organs[i].NDemand;
                }
                if (MathUtilities.IsLessThan(Demand.Structural, 0))
                {
                    throw new Exception(Organs[i].Name + " is returning a negative Structural " + Type + " demand.  Check your parameterisation");
                }
                if (MathUtilities.IsLessThan(Demand.Storage, 0))
                {
                    throw new Exception(Organs[i].Name + " is returning a negative Storage " + Type + " demand.  Check your parameterisation");
                }
                if (MathUtilities.IsLessThan(Demand.Metabolic, 0))
                {
                    throw new Exception(Organs[i].Name + " is returning a negative Metabolic " + Type + " demand.  Check your parameterisation");
                }
                StructuralDemand[i]     = Demand.Structural;
                MetabolicDemand[i]      = Demand.Metabolic;
                StorageDemand[i]        = Demand.Storage;
                Reallocation[i]         = 0;
                Uptake[i]               = 0;
                Fixation[i]             = 0;
                Retranslocation[i]      = 0;
                StructuralAllocation[i] = 0;
                MetabolicAllocation[i]  = 0;
                StorageAllocation[i]    = 0;
            }

            Allocated          = 0;
            SinkLimitation     = 0;
            NutrientLimitation = 0;
        }
Esempio n. 13
0
 /// <summary>Sets the dry matter potential allocation.</summary>
 public void SetDryMatterPotentialAllocation(BiomassPoolType dryMatter)
 {
     potentialDMAllocation.Metabolic  = dryMatter.Metabolic;
     potentialDMAllocation.Structural = dryMatter.Structural;
 }
Esempio n. 14
0
 /// <summary>Sets the dm potential allocation.</summary>
 /// <summary>Sets the dry matter potential allocation.</summary>
 public void SetDryMatterPotentialAllocation(BiomassPoolType dryMatter)
 {
 }
Esempio n. 15
0
 /// <summary>Sets the dry matter potential allocation.</summary>
 public void SetDryMatterPotentialAllocation(BiomassPoolType dryMatter)
 {
     PotentialMetabolicDMAllocation  = dryMatter.Metabolic;
     PotentialStructuralDMAllocation = dryMatter.Structural;
     PotentialDMAllocation           = dryMatter.Structural + dryMatter.Metabolic;
 }
Esempio n. 16
0
    virtual public void DoSetup(List <Organ> Organs, ref BiomassArbitrationType BAT)
    {
        //Creat Biomass variable class
        BAT = new BiomassArbitrationType(Organs.Count);

        // GET ALL INITIAL STATE VARIABLES FOR MASS BALANCE CHECKS
        BAT.Start = 0;

        // GET ALL SUPPLIES AND DEMANDS AND CALCULATE TOTALS
        for (int i = 0; i < Organs.Count; i++)
        {
            BiomassSupplyType Supply = Organs[i].NSupply;
            BAT.ReallocationSupply[i]    = Supply.Reallocation;
            BAT.UptakeSupply[i]          = Supply.Uptake;
            BAT.FixationSupply[i]        = Supply.Fixation;
            BAT.RetranslocationSupply[i] = Supply.Retranslocation;
            BAT.Start += Organs[i].Live.N + Organs[i].Dead.N;
        }

        BAT.TotalReallocationSupply    = MathUtility.Sum(BAT.ReallocationSupply);
        BAT.TotalUptakeSupply          = MathUtility.Sum(BAT.UptakeSupply);
        BAT.TotalFixationSupply        = MathUtility.Sum(BAT.FixationSupply);
        BAT.TotalRetranslocationSupply = MathUtility.Sum(BAT.RetranslocationSupply);

        for (int i = 0; i < Organs.Count; i++)
        {
            BiomassPoolType Demand = Organs[i].NDemand;
            BAT.StructuralDemand[i]    = Organs[i].NDemand.Structural;
            BAT.MetabolicDemand[i]     = Organs[i].NDemand.Metabolic;
            BAT.NonStructuralDemand[i] = Organs[i].NDemand.NonStructural;
            BAT.TotalDemand[i]         = BAT.StructuralDemand[i] + BAT.MetabolicDemand[i] + BAT.NonStructuralDemand[i];

            BAT.Reallocation[i]            = 0;
            BAT.Uptake[i]                  = 0;
            BAT.Fixation[i]                = 0;
            BAT.Retranslocation[i]         = 0;
            BAT.StructuralAllocation[i]    = 0;
            BAT.MetabolicAllocation[i]     = 0;
            BAT.NonStructuralAllocation[i] = 0;
        }

        BAT.TotalStructuralDemand    = MathUtility.Sum(BAT.StructuralDemand);
        BAT.TotalMetabolicDemand     = MathUtility.Sum(BAT.MetabolicDemand);
        BAT.TotalNonStructuralDemand = MathUtility.Sum(BAT.NonStructuralDemand);
        BAT.TotalPlantDemand         = BAT.TotalStructuralDemand + BAT.TotalMetabolicDemand + BAT.TotalNonStructuralDemand;

        DM.TotalStructuralAllocation    = 0;
        DM.TotalMetabolicAllocation     = 0;
        DM.TotalNonStructuralAllocation = 0;

        //Set relative N demands of each organ
        for (int i = 0; i < Organs.Count; i++)
        {
            if (BAT.TotalStructuralDemand > 0)
            {
                BAT.RelativeStructuralDemand[i] = BAT.StructuralDemand[i] / BAT.TotalStructuralDemand;
            }
            if (BAT.TotalMetabolicDemand > 0)
            {
                BAT.RelativeMetabolicDemand[i] = BAT.MetabolicDemand[i] / BAT.TotalMetabolicDemand;
            }
            if (BAT.TotalNonStructuralDemand > 0)
            {
                BAT.RelativeNonStructuralDemand[i] = BAT.NonStructuralDemand[i] / BAT.TotalNonStructuralDemand;
            }
        }
    }
Esempio n. 17
0
    virtual public void DoDMSetup(List <Organ> Organs)
    {
        //Creat Drymatter variable class
        DM = new BiomassArbitrationType(Organs.Count);

        // GET INITIAL STATE VARIABLES FOR MASS BALANCE CHECKS
        DM.Start = 0;

        // GET SUPPLIES AND CALCULATE TOTAL
        for (int i = 0; i < Organs.Count; i++)
        {
            BiomassSupplyType Supply = Organs[i].DMSupply;
            //BiomassSupplyType Supply = null;
            //Activator.CreateInstance(BiomassSupplyType, ("Organs[i].DMSupply", ,);
            DM.ReallocationSupply[i]    = Supply.Reallocation;
            DM.UptakeSupply[i]          = Supply.Uptake;
            DM.FixationSupply[i]        = Supply.Fixation;
            DM.RetranslocationSupply[i] = Supply.Retranslocation;
            //double _dead;
            //Organs[i].My.Get("Dead.Wt", out _dead);
            DM.Start += Organs[i].Live.Wt + Organs[i].Dead.Wt;
        }

        DM.TotalReallocationSupply    = MathUtility.Sum(DM.ReallocationSupply);
        DM.TotalUptakeSupply          = MathUtility.Sum(DM.UptakeSupply);
        DM.TotalFixationSupply        = MathUtility.Sum(DM.FixationSupply);
        DM.TotalRetranslocationSupply = MathUtility.Sum(DM.RetranslocationSupply);

        // SET OTHER ORGAN VARIABLES AND CALCULATE TOTALS
        for (int i = 0; i < Organs.Count; i++)
        {
            BiomassPoolType Demand = Organs[i].DMDemand;
            DM.StructuralDemand[i]    = Demand.Structural;
            DM.MetabolicDemand[i]     = Demand.Metabolic;
            DM.NonStructuralDemand[i] = Demand.NonStructural;
            DM.TotalDemand[i]         = DM.StructuralDemand[i] + DM.MetabolicDemand[i] + DM.NonStructuralDemand[i];

            DM.Reallocation[i]            = 0;
            DM.Uptake[i]                  = 0;
            DM.Fixation[i]                = 0;
            DM.Retranslocation[i]         = 0;
            DM.StructuralAllocation[i]    = 0;
            DM.MetabolicAllocation[i]     = 0;
            DM.NonStructuralAllocation[i] = 0;
        }

        DM.TotalStructuralDemand    = MathUtility.Sum(DM.StructuralDemand);
        DM.TotalMetabolicDemand     = MathUtility.Sum(DM.MetabolicDemand);
        DM.TotalNonStructuralDemand = MathUtility.Sum(DM.NonStructuralDemand);
        DM.TotalPlantDemand         = DM.TotalStructuralDemand + DM.TotalMetabolicDemand + DM.TotalNonStructuralDemand;

        DM.TotalStructuralAllocation    = 0;
        DM.TotalMetabolicAllocation     = 0;
        DM.TotalNonStructuralAllocation = 0;

        //Set relative N demands of each organ
        for (int i = 0; i < Organs.Count; i++)
        {
            if (DM.TotalStructuralDemand > 0)
            {
                DM.RelativeStructuralDemand[i] = DM.StructuralDemand[i] / DM.TotalStructuralDemand;
            }
            if (DM.TotalMetabolicDemand > 0)
            {
                DM.RelativeMetabolicDemand[i] = DM.MetabolicDemand[i] / DM.TotalMetabolicDemand;
            }
            if (DM.TotalNonStructuralDemand > 0)
            {
                DM.RelativeNonStructuralDemand[i] = DM.NonStructuralDemand[i] / DM.TotalNonStructuralDemand;
            }
        }
    }