private double GetSln(ICanopy leaf) { if (leaf is SorghumLeaf sorghumLeaf) { return(sorghumLeaf.SLN); } if (leaf is IArbitration arbitration) { return(arbitration.Live.N / leaf.LAI); } throw new InvalidOperationException($"Unable to calculate SLN from leaf type {leaf.GetType()}"); }
private void SetBiomass(ICanopy leaf, double actualBiomass) { if (leaf is SorghumLeaf sorghumLeaf) { sorghumLeaf.BiomassRUE = actualBiomass; sorghumLeaf.BiomassTE = actualBiomass; } else if (leaf is Leaf complexLeaf) { complexLeaf.DMSupply.Fixation = actualBiomass; } else { throw new InvalidOperationException($"Unable to set biomass from unknown leaf type {leaf.GetType()}"); } }