private void OnPlantSowing(object sender, SowPlant2Type Sow) { if (Sow.Plant == plant) { Clear(); //allow structure to clear leaf on sowing event, otherwise leaf will reset the culms after tthey have been initialised leaf.Clear(); if (Sow.MaxCover <= 0.0) { throw new Exception("MaxCover must exceed zero in a Sow event."); } FertileTillerNumber = Sow.BudNumber; //TotalStemPopn = MainStemPopn; if (leaf.Culms.Count == 0) { //first culm is the main culm leaf.AddCulm(new CulmParameters() { Density = Sow.Population, InitialProportion = 1, InitialAppearanceRate = initialAppearanceRate.Value(), FinalAppearanceRate = finalAppearanceRate.Value(), RemainingLeavesForFinalAppearanceRate = remainingLeavesForFinalAppearanceRate.Value(), LargestLeafSize = leaf.LargestLeafSize, A0 = leaf.A0.Value(), A1 = leaf.A1.Value(), B0 = leaf.B0.Value(), B1 = leaf.B1.Value(), AX0 = leaf.AX0.Value(), LeafNoCorrection = leafNoCorrection.Value(), LeafNoAtAppearance = 0 }); } } }
void addTiller(double leafAtAppearance, double fractionToAdd) { // get number if tillers // add fractionToAdd // if new tiller is needed add one // fraction goes to proportions var nCulms = leaf.Culms.Count; var lastCulm = leaf.Culms[nCulms - 1]; double tillerFraction = lastCulm.Proportion; double fraction = (tillerFraction % 1) + fractionToAdd; //a new tiller is created with each new leaf, up the number of fertileTillers if (tillerFraction + fractionToAdd > 1) { leaf.AddCulm(new CulmParameters() { CulmNumber = nCulms, Proportion = fraction, VerticalAdjustment = tillersAdded * verticalAdjustment.Value(), //add aMaxVert in calc LeafAtAppearance = leafAtAppearance }); //bell curve distribution is adjusted horizontally by moving the curve to the left. //This will cause the first leaf to have the same value as the nth leaf on the main culm. //T3&&T4 were defined during dicussion at initial tillering meeting 27/06/12 //all others are an assumption //T2 = 3 Leaves //T3 = 4 Leaves //T4 = 5 leaves //T5 = 6 leaves //T6 = 7 leaves } else { lastCulm.Proportion = fraction; } tillersAdded += fractionToAdd; }