Exemplo n.º 1
0
        /// <summary>Accumulate all of the Organ DM Supplies </summary>
        public virtual void DMSupplies()
        {
            // Setup DM supplies from each organ
            SetDMSupply?.Invoke(this, new EventArgs());
            BiomassSupplyType[] supplies = Organs.Select(organ => organ.DMSupply).ToArray();

            double totalWt = Organs.Sum(o => o.Total.Wt);

            DM.GetSupplies(supplies, totalWt);
        }
Exemplo n.º 2
0
        private void OnDoPotentialPlantPartioning(object sender, EventArgs e)
        {
            if (Plant.IsEmerged)
            {
                DM.Clear();
                // Setup DM supplies from each organ
                SetDMSupply?.Invoke(this, new EventArgs());
                BiomassSupplyType[] supplies = Organs.Select(organ => organ.DMSupply).ToArray();


                double totalWt = Organs.Sum(o => o.Total.Wt);
                DM.GetSupplies(supplies, totalWt);
                // Subtract maintenance respiration
                double maintenanceRespiration = Organs.Sum(o => o.MaintenanceRespiration);
                if (maintenanceRespiration > 0)
                {
                    SubtractMaintenanceRespiration(maintenanceRespiration);
                }

                // Setup DM demands for each organ
                SetDMDemand?.Invoke(this, new EventArgs());
                BiomassPoolType[] demands = Organs.Select(organ => organ.DMDemand).ToArray();
                DM.GetDemands(demands);

                Reallocation(Organs.ToArray(), DM, DMArbitrator);         // Allocate supply of reallocated DM to organs
                AllocateFixation(Organs.ToArray(), DM, DMArbitrator);     // Allocate supply of fixed DM (photosynthesis) to organs
                Retranslocation(Organs.ToArray(), DM, DMArbitrator);      // Allocate supply of retranslocated DM to organs
                SendPotentialDMAllocations(Organs.ToArray());             // Tell each organ what their potential growth is so organs can calculate their N demands


                N.Clear();

                // Setup N supplies from each organ
                SetNSupply?.Invoke(this, new EventArgs());
                supplies = Organs.Select(organ => organ.NSupply).ToArray();
                double totalN = Organs.Sum(o => o.Total.N);
                N.GetSupplies(supplies, totalN);

                // Setup N demands
                SetNDemand?.Invoke(this, new EventArgs());
                demands = Organs.Select(organ => organ.NDemand).ToArray();
                N.GetDemands(demands);

                Reallocation(Organs.ToArray(), N, NArbitrator);           // Allocate N available from reallocation to each organ
            }
        }