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

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

limiting e-motor voltage levels to min/max available voltage levels

parent 94c1dd88
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
public NewtonMeter LookupDragTorque(Volt voltage, PerSecond avgSpeed)
{
var tuple = VoltageLevels.GetSection(x => voltage > x.Voltage);
var tuple = GetSection(voltage);
return VectoMath.Interpolate(tuple.Item1.Voltage, tuple.Item2.Voltage,
tuple.Item1.DragCurve.Lookup(avgSpeed),
......@@ -73,7 +73,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
if (avgSpeed.IsGreaterOrEqual(MaxSpeed)) {
return 0.SI<NewtonMeter>();
}
var tuple = VoltageLevels.GetSection(x => voltage > x.Voltage);
var tuple = GetSection(voltage);
var r1 = tuple.Item1.EfficiencyMap.LookupTorque(electricPower, avgSpeed, maxEmTorque);
var r2 = tuple.Item2.EfficiencyMap.LookupTorque(electricPower, avgSpeed, maxEmTorque);
......@@ -102,7 +102,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
public EfficiencyMap.EfficiencyResult LookupElectricPower(Volt voltage, PerSecond avgSpeed, NewtonMeter torque, bool allowExtrapolation = false)
{
var tuple = VoltageLevels.GetSection(x => voltage > x.Voltage);
var tuple = GetSection(voltage);
var r1 = tuple.Item1.EfficiencyMap.LookupElectricPower(avgSpeed, torque, allowExtrapolation);
var r2 = tuple.Item2.EfficiencyMap.LookupElectricPower(avgSpeed, torque, allowExtrapolation);
......@@ -128,7 +128,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
public NewtonMeter FullGenerationTorque(Volt voltage, PerSecond avgSpeed)
{
var tuple = VoltageLevels.GetSection(x => voltage > x.Voltage);
var tuple = GetSection(voltage);
return VectoMath.Interpolate(tuple.Item1.Voltage, tuple.Item2.Voltage,
tuple.Item1.FullLoadCurve.FullGenerationTorque(avgSpeed),
......@@ -137,12 +137,24 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
public NewtonMeter FullLoadDriveTorque(Volt voltage, PerSecond avgSpeed)
{
var tuple = VoltageLevels.GetSection(x => voltage > x.Voltage);
var tuple = GetSection(voltage);
return VectoMath.Interpolate(tuple.Item1.Voltage, tuple.Item2.Voltage,
tuple.Item1.FullLoadCurve.FullLoadDriveTorque(avgSpeed),
tuple.Item2.FullLoadCurve.FullLoadDriveTorque(avgSpeed), voltage);
}
protected Tuple<ElectricMotorVoltageLevelData, ElectricMotorVoltageLevelData> GetSection(Volt voltage)
{
if (voltage < VoltageLevels.First().Voltage) {
return Tuple.Create(VoltageLevels.First(), VoltageLevels.First());
}
if (voltage > VoltageLevels.Last().Voltage) {
return Tuple.Create(VoltageLevels.Last(), VoltageLevels.Last());
}
return VoltageLevels.GetSection(x => voltage > x.Voltage);
}
}
public class ElectricMotorVoltageLevelData
......
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