Skip to content

Commit

Permalink
More Deropapy
Browse files Browse the repository at this point in the history
  • Loading branch information
HamishBrownPFR committed Dec 15, 2023
1 parent 820311a commit 3b5b1b5
Show file tree
Hide file tree
Showing 3 changed files with 6,404 additions and 838 deletions.
46 changes: 35 additions & 11 deletions Models/PMF/SimplePlantModels/DEROPAPY.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,9 @@ private void OnStartOfDay(object sender, EventArgs e)
}
}

private bool RootThyNeighbour = false;
private double MaxRD = 3000;
private double AgeAtSimulationStart = 1.0;
private double YearsToMaxDimension = 1.0;

//private bool RootThyNeighbour = false;
//private double AgeAtSimulationStart = 1.0;

/// <summary> Method that sets DEROPAPY running</summary>
public void Establish()
{
Expand All @@ -216,9 +214,9 @@ public void Establish()
break;
}

//double rootDepth = Math.Min(MaxRD, soilDepthMax);
double rootDepth = 1500;
double rootDepth = Math.Min(Double.Parse(Current["MaxRootDepth"]), soilDepthMax);

bool RootThyNeighbour = bool.Parse(Current["RootTheNeighboursZone"]);
if (RootThyNeighbour)
{ //Must add root zone prior to sowing the crop. For some reason they (silently) dont add if you try to do so after the crop is established
string neighbour = "";
Expand Down Expand Up @@ -248,9 +246,9 @@ public void Establish()
}
}


double AgeAtSimulationStart = Double.Parse(Current["AgeAtStartSimulation"]);
string cropName = this.Name;
double depth = Math.Min(this.MaxRD * this.AgeAtSimulationStart / this.YearsToMaxDimension, rootDepth);
double depth = Math.Min(Double.Parse(Current["MaxRootDepth"]) * AgeAtSimulationStart / Double.Parse(Current["AgeToMaxDimension"]), rootDepth);
double population = 1.0;
double rowWidth = 0.0;

Expand All @@ -259,7 +257,7 @@ public void Establish()
deropapy.Sow(cropName, population, depth, rowWidth);
phenology.SetAge(AgeAtSimulationStart);
summary.WriteMessage(this, "Some of the message above is not relevent as DEROPAPY has no notion of population, bud number or row spacing." +
" Additional info that may be useful. " + this.Name + " is established as " + this.AgeAtSimulationStart.ToString() + " Year old plant "
" Additional info that may be useful. " + this.Name + " is established as " + AgeAtSimulationStart.ToString() + " Year old plant "
, MessageType.Information);
}

Expand Down Expand Up @@ -308,6 +306,19 @@ public Cultivar coeffCalc()
thisDero["RUEtotal"] += clean(Current["RUEtotal"]);
thisDero["RUETempThresholds"] += clean(Current["RUETempThresholds"]);
thisDero["PhotosynthesisType"] += clean(Current["PhotosynthesisType"]);
thisDero["LeafPartitionFrac"] += clean(Current["LeafPartitionFrac"]);
thisDero["ProductPartitionFrac"] += clean(Current["ProductPartitionFrac"]);
thisDero["RootPartitionFrac"] += clean(Current["RootPartitionFrac"]);
thisDero["TrunkPartitionFrac"] += clean(Current["TrunkPartitionFrac"]);
thisDero["LeafMaxNConc"] += clean(Current["LeafMaxNConc"]);
thisDero["LeafMinNConc"] += clean(Current["LeafMinNConc"]);
thisDero["ProductMaxNConc"] += clean(Current["ProductMaxNConc"]);
thisDero["ProductMinNConc"] += clean(Current["ProductMinNConc"]);
thisDero["RootMaxNConc"] += clean(Current["RootMaxNConc"]);
thisDero["RootMinNConc"] += clean(Current["RootMinNConc"]);
thisDero["TrunkMaxNConc"] += clean(Current["TrunkMaxNConc"]);
thisDero["TrunkMinNConc"] += clean(Current["TrunkMinNConc"]);
thisDero["MaxRootDepth"] += clean(Current["MaxRootDepth"]);

string[] commands = new string[deroParams.Count];
thisDero.Values.CopyTo(commands, 0);
Expand Down Expand Up @@ -346,7 +357,20 @@ public Cultivar coeffCalc()
{"ExtCoeffWaterStressSens","[DEROPAPY].Leaf.Canopy.GreenExtinctionCoefficient.WaterStress.XYPairs.Y[1] = " },
{"RUEtotal","[DEROPAPY].Leaf.Photosynthesis.RUE.FixedValue = " },
{"RUETempThresholds","[DEROPAPY].Leaf.Photosynthesis.FT.XYPairs.X = " },
{"PhotosynthesisType","[DEROPAPY].Leaf.Photosynthesis.FCO2.PhotosyntheticPathway = " }
{"PhotosynthesisType","[DEROPAPY].Leaf.Photosynthesis.FCO2.PhotosyntheticPathway = " },
{"LeafPartitionFrac","[DEROPAPY].Leaf.TotalDMDemand.PartitionFraction.FixedValue = " },
{"ProductPartitionFrac","[DEROPAPY].Product.TotalDMDemand.PartitionFraction.FixedValue = " },
{"RootPartitionFrac","[DEROPAPY].Root.TotalDMDemand.PartitionFraction.FixedValue = " },
{"TrunkPartitionFrac","[DEROPAPY].Trunk.TotalDMDemand.PartitionFraction.FixedValue = " },
{"LeafMaxNConc","[DEROPAPY].Leaf.Nitrogen.ConcFunctions.Maximum.XYPairs.Y[2] = " },
{"LeafMinNConc","[DEROPAPY].Leaf.Nitrogen.ConcFunctions.Minimum.FixedValue = " },
{"ProductMaxNConc","[DEROPAPY].Product.Nitrogen.ConcFunctions.Maximum.XYPairs.Y[2] = " },
{"ProductMinNConc","[DEROPAPY].Product.Nitrogen.ConcFunctions.Minimum.FixedValue = " },
{"RootMaxNConc","[DEROPAPY].Root.Nitrogen.ConcFunctions.Maximum.FixedValue = " },
{"RootMinNConc","[DEROPAPY].Root.Nitrogen.ConcFunctions.Minimum.FixedValue = " },
{"TrunkMaxNConc","[DEROPAPY].Trunk.Nitrogen.ConcFunctions.Maximum.FixedValue = " },
{"TrunkMinNConc","[DEROPAPY].Trunk.Nitrogen.ConcFunctions.Minimum.FixedValue = " },
{"MaxRootDepth","[DEROPAPY].Root.Network.MaximumRootDepth.FixedValue = " },
};
}
}
Loading

0 comments on commit 3b5b1b5

Please sign in to comment.