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

Skip to content
Snippets Groups Projects
Commit 2e4bc3db authored by Michael KRISPER's avatar Michael KRISPER Committed by Markus Quaritsch
Browse files

Pull request #156: ElectricMotorData.EfficiencyMapLookupTorque: Fixed bug when...

Pull request #156: ElectricMotorData.EfficiencyMapLookupTorque: Fixed bug when only one level is limited by battery, but the other is not.

Merge in VECTO/vecto-dev from VECTO/mk_vecto-dev:bugfix/VECTO-1531-electricmotor-lookup-maximum-torque to develop

* commit 'd30de630':
  ElectricMotorData.EfficiencyMapLookupTorque: Fixed bug when only one level is limited by battery, but the other is not.
parents 492f1c8a d30de630
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