Ejemplo n.º 1
0
        /// <summary>Retranslocates the dm.</summary>
        /// <param name="Organs">The organs.</param>
        internal void RetranslocateDM(List <Organ1> Organs)
        {
            double dlt_dm_retrans_part;                    // carbohydrate removed from part (g/m^2)
            double dm_part_avail;                          // carbohydrate avail from part(g/m^2)
            double dm_retranslocate = 0.0;

            // now translocate carbohydrate between plant components
            // this is different for each stage

            // plant.All().dlt_dm_green_retrans_hack( 0.0 );   ????????

            double demand_differential_begin = 0.0;

            foreach (Organ1 Organ in Organs)
            {
                demand_differential_begin += Organ.DMDemandDifferential;
            }
            double demand_differential = demand_differential_begin;

            // get available carbohydrate from supply pools
            foreach (Organ1 Organ in Organs)
            {
                dm_part_avail = Organ.DMRetransSupply;

                dlt_dm_retrans_part = Math.Min(demand_differential, dm_part_avail);

                //assign and accumulate
                Organ.Retranslocation.NonStructuralWt = -dlt_dm_retrans_part;
                dm_retranslocate += -dlt_dm_retrans_part;

                demand_differential = demand_differential - dlt_dm_retrans_part;
            }

            double dlt_dm_retrans_to_fruit = -dm_retranslocate;

            double dm_demand_differential = 0;

            foreach (Organ1 Organ in Organs)
            {
                dm_demand_differential += Organ.DMDemandDifferential;
            }
            double dlt_dm_green_retrans = dlt_dm_retrans_to_fruit * MathUtilities.Divide(dm_demand_differential, demand_differential_begin, 0.0);

            // get available carbohydrate from local supply pools
            double Retranslocation = 0.0;

            foreach (Organ1 Organ in Organs)
            {
                Retranslocation += Organ.Retranslocation.Wt;
            }

            double dlt_dm_green_retrans_tot = dlt_dm_green_retrans; // +-Retranslocation;

            // now distribute the assimilate to plant parts
            double FinalRetranslocation = 0.0;

            foreach (Organ1 Organ in Organs)
            {
                Organ.DoDmRetranslocate(dlt_dm_green_retrans_tot, dm_demand_differential);
                if (Organ.Retranslocation.Wt > 0)  // movement of assimilate  into organ
                {
                    FinalRetranslocation += Organ.Retranslocation.Wt;
                }
            }

            // do mass balance check
            if (!MathUtilities.FloatsAreEqual(FinalRetranslocation, dlt_dm_green_retrans))
            {
                string msg = "dlt_dm_green_retrans_tot mass balance is off: "
                             + FinalRetranslocation.ToString("f6")
                             + " vs "
                             + dlt_dm_green_retrans.ToString("f6");
                Summary.WriteWarning(this, msg);
            }
            Util.Debug("Arbitrator.FinalRetranslocation=%f", -FinalRetranslocation);
        }