Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

IEPC: handle the case that power map contains only a single entry with 0 Nm...

IEPC: handle the case that power map contains only a single entry with 0 Nm when extending the power map
parent 8f81e6c7
No related branches found
No related tags found
No related merge requests found
......@@ -182,21 +182,33 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData
var prev = orderedBuckets[i - 1];
var next = orderedBuckets[i + 1];
//Drive
if (current.Value.MinBy(x => x.Torque).Torque / prev.Value.MinBy(x => x.Torque).Torque < ignoreThreshold
&&
current.Value.MinBy(x => x.Torque).Torque / next.Value.MinBy(x => x.Torque).Torque < ignoreThreshold) {
if (prev.Value.MinBy(x => x.Torque).Torque.IsEqual(0) || next.Value.MinBy(x => x.Torque).Torque.IsEqual(0)) {
ignoredSpeedBucketsDrive.Add(current.Key);
} else {
if (current.Value.MinBy(x => x.Torque).Torque / prev.Value.MinBy(x => x.Torque).Torque <
ignoreThreshold
&&
current.Value.MinBy(x => x.Torque).Torque / next.Value.MinBy(x => x.Torque).Torque <
ignoreThreshold) {
ignoredSpeedBucketsDrive.Add(current.Key);
}
}
//Recuperation
if (current.Value.MaxBy(x => x.Torque).Torque / prev.Value.MaxBy(x => x.Torque).Torque < ignoreThreshold
&&
current.Value.MaxBy(x => x.Torque).Torque / next.Value.MaxBy(x => x.Torque).Torque < ignoreThreshold)
{
//Recuperation
if (prev.Value.MaxBy(x => x.Torque).Torque.IsEqual(0) || next.Value.MaxBy(x => x.Torque).Torque.IsEqual(0)) {
ignoredSpeedBucketsRecuperation.Add(current.Key);
} else {
if (current.Value.MaxBy(x => x.Torque).Torque / prev.Value.MaxBy(x => x.Torque).Torque <
ignoreThreshold
&&
current.Value.MaxBy(x => x.Torque).Torque / next.Value.MaxBy(x => x.Torque).Torque <
ignoreThreshold) {
ignoredSpeedBucketsRecuperation.Add(current.Key);
}
}
}
}
......@@ -211,8 +223,8 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData
var maxRecuperationEntry = speedBucket.Value.MaxBy(x => x.Torque);
var maxDriveEntry = speedBucket.Value.MinBy(x => x.Torque); //drive torque < 0
var recuperationFactor = maxTargetTorque / maxRecuperationEntry.Torque;
var driveFactor = minTargetTorque / maxDriveEntry.Torque;
var recuperationFactor = maxRecuperationEntry.Torque.IsEqual(0) ? 1.0 : maxTargetTorque / maxRecuperationEntry.Torque;
var driveFactor = maxDriveEntry.Torque.IsEqual(0) ? 1.0 : minTargetTorque / maxDriveEntry.Torque;
//Recuperation
if (!recuperationFactor.IsSmallerOrEqual(1) && !ignoredSpeedBucketsRecuperation.Contains(speedBucket.Key)) {
......@@ -251,7 +263,7 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData
return entries;
}
private static Scalar CalculateExtrapolationFactor(Scalar targetFactor, int currentStep,
private static double CalculateExtrapolationFactor(double targetFactor, int currentStep,
uint nrOfSteps)
{
if (currentStep < 1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment