private void OnDoPotentialPlantPartioning(object sender, EventArgs e) { if (Plant.IsEmerged) { DM.Clear(); // Setup DM supplies from each organ BiomassSupplyType[] supplies = Organs.Select(organ => organ.CalculateDryMatterSupply()).ToArray(); double totalWt = Organs.Sum(o => o.Total.Wt); DM.SetupSupplies(supplies, totalWt); BiomassPoolType[] demands = Organs.Select(organ => organ.CalculateDryMatterDemand()).ToArray(); DM.SetupDemands(demands); DoReAllocation(Organs.ToArray(), DM, DMArbitrator); // Allocate supply of reallocated DM to organs DoFixation(Organs.ToArray(), DM, DMArbitrator); // Allocate supply of fixed DM (photosynthesis) to organs DoRetranslocation(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 supplies = Organs.Select(organ => organ.CalculateNitrogenSupply()).ToArray(); double totalN = Organs.Sum(o => o.Total.N); N.SetupSupplies(supplies, totalN); // Setup N demands demands = Organs.Select(organ => organ.CalculateNitrogenDemand()).ToArray(); N.SetupDemands(demands); DoReAllocation(Organs.ToArray(), N, NArbitrator); // Allocate N available from reallocation to each organ } }
virtual protected void OnDoPotentialPlantPartioning(object sender, EventArgs e) { if (Plant.IsEmerged) { DM.Clear(); N.Clear(); DMSupplies(); DMDemands(); PotentialDMAllocation(); NSupplies(); NDemands(); Reallocation(Organs.ToArray(), N, NArbitrator); // Allocate N available from reallocation to each organ } }
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 } }
virtual protected void OnDoPotentialPlantPartioning(object sender, EventArgs e) { if (plant.IsEmerged) { DM.Clear(); N.Clear(); DMSupplies(); DMDemands(); dmArbitration.DoPotentialPartitioning(Organs.ToArray(), DM); NSupplies(); NDemands(); nArbitration.DoPotentialPartitioning(Organs.ToArray(), N); } }