Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit d30de630 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

ElectricMotorData.EfficiencyMapLookupTorque: Fixed bug when only one level is...

ElectricMotorData.EfficiencyMapLookupTorque: Fixed bug when only one level is limited by battery, but the other is not.
parent 492f1c8a
No related branches found
No related tags found
No related merge requests found
......@@ -53,10 +53,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
var r1 = a.EfficiencyMap.LookupTorque(electricPower, avgSpeed, maxEmTorque);
var r2 = b.EfficiencyMap.LookupTorque(electricPower, avgSpeed, maxEmTorque);
if (r1 == null && r2 == null) {
if (r1 is null && r2 is null) {
return null;
}
// if one of the values is limited by EM, but the other is not (is null): use maxEmTorque instead
if (r1 is null) {
r1 = maxEmTorque;
}
if (r2 is null) {
r2 = maxEmTorque;
}
var retVal = VectoMath.Interpolate(a.Voltage, b.Voltage,
r1, r2, voltage);
var elPwr = LookupElectricPower(voltage, avgSpeed, retVal, true);
......
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