/// <summary> implement the IFunction interface - code is currently coupled to Leafculms /// Could be refactored to use an interface of Culms /// </summary> public double Value(int arrayIndex = -1) { if (culms == null) { culms = Parent as LeafCulms ?? throw new Exception("C4LeafArea expects a LeafCulms as a parent: " + Parent?.Name ?? "Null"); } return(calcPotentialLeafArea(culms)); }
/// <summary> Calculate the potential area for all culms</summary> public double calcPotentialLeafArea(LeafCulms culms) { var dltCulmArea = 0.0; foreach (var culm in culms.Culms) { //once leaf no is calculated leaf area of largest expanding leaf is determined double leafNoEffective = Math.Min(culm.CurrentLeafNo + leafNoCorrection.Value(), culm.FinalLeafNo - culm.LeafNoAtAppearance); var tmpArea = CalculateIndividualLeafArea(leafNoEffective, culm.FinalLeafNo, culm.VertAdjValue).ConvertSqM2SqMM(); culm.LeafArea = tmpArea * sowingDensity * culm.dltLeafNo; // in dltLai culm.TotalLAI += culm.LeafArea; //not sure what this is doing as actual growth may adjust this dltCulmArea += culm.LeafArea * culm.Proportion; } return(dltCulmArea); }