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
Commit b1bd6cd5 authored by Markus Quaritsch's avatar Markus Quaritsch Committed by Stefanos DOUMPOULAKIS
Browse files

in case the calculation of the max. em torque for a given battery power fails,...

in case the calculation of the max. em torque for a given battery power fails, use a fallback method to estimate if the max. EM torque can be used.
parent 71c0ae06
Branches
Tags
No related merge requests found
...@@ -486,9 +486,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -486,9 +486,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// has to be positive for recuperation - battery is full // has to be positive for recuperation - battery is full
return null; return null;
} }
var maxBatRecuperationTorque = maxBatPower.IsEqual(0, 1e-3)
NewtonMeter maxBatRecuperationTorque;
try {
maxBatRecuperationTorque = maxBatPower.IsEqual(0, 1e-3)
? ModelData.DragCurveLookup(avgSpeed, gear) ? ModelData.DragCurveLookup(avgSpeed, gear)
: ModelData.EfficiencyData.EfficiencyMapLookupTorque(volt, maxBatPower, avgSpeed, maxEmTorque, gear); : ModelData.EfficiencyData.EfficiencyMapLookupTorque(volt, maxBatPower, avgSpeed, maxEmTorque,
gear);
} catch (VectoException e) {
var pwr = ModelData.EfficiencyData.LookupElectricPower(volt, avgSpeed, maxEmTorque, gear);
if (pwr.ElectricalPower.IsSmaller(maxBatPower)) {
maxBatRecuperationTorque = maxEmTorque;
} else {
throw new VectoException("Failed to get max. recuperation torque", e);
}
}
var maxTorqueRecuperate = VectoMath.Min(maxEmTorque, maxBatRecuperationTorque); var maxTorqueRecuperate = VectoMath.Min(maxEmTorque, maxBatRecuperationTorque);
if (maxTorqueRecuperate < 0) { if (maxTorqueRecuperate < 0) {
return null; return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment