added detailed output for KPI C1 effective organic matter supply

This commit is contained in:
2024-02-16 12:58:00 +01:00
parent 5d02370f56
commit 5399fd66df
3 changed files with 58 additions and 8 deletions

View File

@@ -87,8 +87,8 @@ namespace FarmmapsKPI
TimeSpan tsRemaining;
TimeSpan tsTotalEstimated;
for (int i = 0; i < fieldsInputs.Count; i++)
//for (int i = 3; i < 4; i++)
//for (int i = 0; i < fieldsInputs.Count; i++)
for (int i = 3; i < 4; i++)
{
watch.Restart();
input = fieldsInputs[i];
@@ -476,6 +476,48 @@ namespace FarmmapsKPI
sw.WriteLine(string.Join(",", dataList));
}
}
else if (kpio.id == "C1") //TtD
{
//Make a new dataList = new line to be written
dataList = new List<string> { };
//Fill the datalist with this kpi
dataList.Add(kpio.parentName);
dataList.Add(cropfieldItem.Code);
dataList.Add(kpio.data.area);
dataList.Add(kpio.data.cropTypeCode);
dataList.Add(kpio.data.cropTypeName);
dataList.Add(kpio.id);
dataList.Add(kpio.quantity); // in KPI output quantity is what we call KPIvariable in headerlist of csv file
dataList.Add(kpio.value);
dataList.Add(kpio.unit);
dataList.Add(kpio.targetValue);
dataList.Add(kpio.thresholdValue);
//Write the datalist to a line to the streamwrieter sw for the output csv file
sw.WriteLine(string.Join(",", dataList));
KPIelementsOfBalance kPIelementsOfBalance = kpio.data.values;
foreach (string elementName in kpio.C1elements)
{
// get C1element from the element called values
dataList = new List<string> { };
string elementValue = (string)kPIelementsOfBalance.GetType().GetProperty(elementName).GetValue(kPIelementsOfBalance, null);
dataList.Add(kpio.parentName);
dataList.Add(cropfieldItem.Code);
dataList.Add(kpio.data.area);
dataList.Add(kpio.data.cropTypeCode);
dataList.Add(kpio.data.cropTypeName);
dataList.Add(kpio.id);
dataList.Add(elementName); // specific output variable name for C1 element
dataList.Add(elementValue); // specific output value name for C1 element
dataList.Add(kpio.unit);
dataList.Add("");
dataList.Add("");
//Write the datalist to a line to the streamwrieter sw for the output csv file
sw.WriteLine(string.Join(",", dataList));
}
}
else if (kpio.id == "E1")
{
//for E1, environmentMeasureData is an array of elements with 1 per pesticide. Inside each element there are multiple mbp_KPIvariables to be written