Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Verified Commit a307944a authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

bugfix capacity calculation in case the SoC Map does not cover the range from...

bugfix capacity calculation in case the SoC Map does not cover the range from 0 to 100: copy min/max entries to 0/100% SoC
parent 37a3b81e
No related branches found
No related tags found
No related merge requests found
......@@ -37,11 +37,27 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData {
Fields.BatteryVoltage,
data.Columns.Cast<DataColumn>().Select(c => c.ColumnName).Join());
}
return new SOCMap(data.Rows.Cast<DataRow>().Select(row => new SOCMap.SOCMapEntry
{
var entries = data.Rows.Cast<DataRow>().Select(row => new SOCMap.SOCMapEntry {
SOC = row.ParseDouble(Fields.StateOfCharge) / 100,
BatteryVolts = row.ParseDouble(Fields.BatteryVoltage).SI<Volt>()
}).OrderBy(e => e.SOC).ToArray());
}).OrderBy(e => e.SOC).ToList();
var first = entries.FirstOrDefault();
var last = entries.LastOrDefault();
if (first.SOC > 0) {
entries.Add(new SOCMap.SOCMapEntry() {
SOC = 0,
BatteryVolts = first.BatteryVolts
});
}
if (last.SOC < 1) {
entries.Add(new SOCMap.SOCMapEntry() {
SOC = 1,
BatteryVolts = last.BatteryVolts
});
}
return new SOCMap(entries.OrderBy(x => x.SOC).ToArray());
}
public static class Fields
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment