/// <summary>Subtract maintenance respiration from daily fixation</summary> /// <param name="respiration">The toal maintenance respiration</param> public void SubtractMaintenanceRespiration(double respiration) { double total = DM.TotalFixationSupply; // First: from daily fixation double respirationFixation = respiration <= total ? respiration : total; double ratio = (total - respirationFixation) / total; for (int i = 0; i < DM.FixationSupply.Length; i++) { DM.FixationSupply[i] *= ratio; } // Second: from live component if there are not enough fixation if (respiration > total) { double remainRespiration = respiration - total; for (int i = 0; i < Organs.ToArray().Length; i++) { if ((Organs[i].Live.StorageWt + Organs[i].Live.MetabolicWt) > 0) { double organRespiration = remainRespiration * Organs[i].MaintenanceRespiration / respiration; Organs[i].RemoveMaintenanceRespiration(organRespiration); } } } }
/// <summary> /// Set the sw uptake for today /// </summary> public override void SetActualNitrogenUptakes(List<ZoneWaterAndN> zones) { if (Plant.IsEmerged) { // Calculate the total no3 and nh4 across all zones. var nSupply = 0.0;//NOTE: This is in kg, not kg/ha, to arbitrate N demands for spatial simulations. NMassFlowSupply = 0.0; //rewporting variables NDiffusionSupply = 0.0; var supply = 0.0; foreach (ZoneWaterAndN Z in zones) { supply += MathUtilities.Sum(Z.NO3N); //NMassFlowSupply += MathUtilities.Sum(Z.NH4N); nSupply += supply * Z.Zone.Area; for(int i = 0; i < Z.NH4N.Length; ++i) Z.NH4N[i] = 0; } //NDiffusionSupply = supply - NMassFlowSupply; //Reset actual uptakes to each organ based on uptake allocated by soil arbitrator and the organs proportion of potential uptake for (int i = 0; i < Organs.Count; i++) N.UptakeSupply[i] = nSupply / Plant.Zone.Area * N.UptakeSupply[i] / N.TotalUptakeSupply * kgha2gsm; //Allocate N that the SoilArbitrator has allocated the plant to each organ AllocateUptake(Organs.ToArray(), N, NArbitrator); Plant.Root.DoNitrogenUptake(zones); } }
override protected void OnDoActualPlantPartioning(object sender, EventArgs e) { if (Plant.IsEmerged) { AllocateFixation(Organs.ToArray(), N, NArbitrator); //Allocate supply of fixable Nitrogen to each organ Retranslocation(Organs.ToArray(), N, NArbitrator); //Allocate supply of retranslocatable N to each organ CalculatedNutrientConstrainedDMAllocation(Organs.ToArray()); //Work out how much DM can be assimilated by each organ based on allocated nutrients SetDryMatterAllocations(Organs.ToArray()); //Tell each organ how DM they are getting folling allocation SetNitrogenAllocations(Organs.ToArray()); //Tell each organ how much nutrient they are getting following allocaition } }
override protected void OnDoPotentialPlantPartioning(object sender, EventArgs e) { if (Plant.IsEmerged) { DM.Clear(); N.Clear(); DMSupplies(); DMDemands(); PotentialDMAllocation(); leaf.UpdateArea(); NSupplies(); NDemands(); Reallocation(Organs.ToArray(), N, NArbitrator); // Allocate N available from reallocation to each organ } }