From 223e32114d7a7cfa71fa49dba7e7e6a7f70abd5b Mon Sep 17 00:00:00 2001 From: Bangyou Zheng Date: Thu, 18 Apr 2024 14:26:44 +1000 Subject: [PATCH] Update method to calculate minimum N concentration --- Models/PMF/Organs/ReproductiveOrgan.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Models/PMF/Organs/ReproductiveOrgan.cs b/Models/PMF/Organs/ReproductiveOrgan.cs index 9bed9209b4..de87ad16f5 100644 --- a/Models/PMF/Organs/ReproductiveOrgan.cs +++ b/Models/PMF/Organs/ReproductiveOrgan.cs @@ -369,7 +369,25 @@ public double MinNconc { get { - return MinimumNConc.Value(); + // Biomass allocation today + double dmAllocation = potentialDMAllocation.Storage + + potentialDMAllocation.Structural + + potentialDMAllocation.Metabolic; + // Required the minimum nitrogen content according to biomass at the end of day + // and minimum nitrogen concentration + double requiredMinNContent = (Live.Wt + dmAllocation) * MinimumNConc.Value(); + // "requiredMinNContent - Live.N" is the deficit of nitrogen in grain. + // Negative: enough nitrogen for grain + // Positive: no enough nitrogen for grain + // (requiredMinNContent - Live.N) / dmAllocation: Convert to nitrogen concentration + // 0.00001: A small value for minimum nitrogen concentration which cannot + // be zero in the arbitration model + double minNConc = 0.00001; + if (dmAllocation > 0) + { + minNConc = Math.Max(0.00001, (requiredMinNContent - Live.N) / dmAllocation); + } + return minNConc; } }