예제 #1
0
 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()}");
 }
예제 #2
0
 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()}");
     }
 }