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

Skip to content
Snippets Groups Projects
Commit 8cc8380f authored by Harald Martini's avatar Harald Martini
Browse files

updated GenericIEPCData

parent 85bc5e8a
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,8 @@ using TUGraz.VectoCore.InputData.Reader.ComponentData; ...@@ -8,6 +8,8 @@ using TUGraz.VectoCore.InputData.Reader.ComponentData;
using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor; using TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor;
using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
using TUGraz.VectoCore.Models.SimulationComponent.Impl;
using TUGraz.VectoCore.Utils; using TUGraz.VectoCore.Utils;
...@@ -17,14 +19,17 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -17,14 +19,17 @@ namespace TUGraz.VectoCore.Models.GenericModelData
{ {
#region Constant #region Constant
public const double GearEfficiency = 0.95; public const double GenericGearEfficiency = 0.96;
public const double GenericAxleGearEfficiency = 0.96;
#endregion #endregion
private double axleEfficiency; private readonly GenericTransmissionComponentData _genericTransmission = new GenericTransmissionComponentData();
private Dictionary<int, double> gearRatios;
private double axleRatio; private double _axleEfficiency;
private KeyValuePair<int, double> gearRatioAtMeasurement; private Dictionary<int, double> _gearRatios;
private double _axleRatio;
private KeyValuePair<int, double> _gearRatioAtMeasurement;
public GenericBusIEPCData() public GenericBusIEPCData()
{ {
...@@ -34,9 +39,9 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -34,9 +39,9 @@ namespace TUGraz.VectoCore.Models.GenericModelData
$"{DeclarationData.DeclarationDataResourcePrefix}.GenericBusData.EfficiencyMap_IEPC_PSM_normalized.vmap"; $"{DeclarationData.DeclarationDataResourcePrefix}.GenericBusData.EfficiencyMap_IEPC_PSM_normalized.vmap";
} }
public IEPCElectricMotorData CreateIEPCElectricMotorData(IIEPCDeclarationInputData iepcData, IAxleGearInputData axleGearData) public IEPCElectricMotorData CreateIEPCElectricMotorData(IIEPCDeclarationInputData iepcData)
{ {
InitData(iepcData, axleGearData); InitData(iepcData);
var count = iepcData.DesignTypeWheelMotor && iepcData.NrOfDesignTypeWheelMotorMeasured == 1 ? 2 : 1; //? also for declaration mode valid var count = iepcData.DesignTypeWheelMotor && iepcData.NrOfDesignTypeWheelMotorMeasured == 1 ? 2 : 1; //? also for declaration mode valid
...@@ -44,33 +49,32 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -44,33 +49,32 @@ namespace TUGraz.VectoCore.Models.GenericModelData
IEPCDragCurves = GetIEPCDragCurves(iepcData, count), IEPCDragCurves = GetIEPCDragCurves(iepcData, count),
EfficiencyData = GetIEPCVoltageLevelData(iepcData.VoltageLevels, count, iepcData.ElectricMachineType), EfficiencyData = GetIEPCVoltageLevelData(iepcData.VoltageLevels, count, iepcData.ElectricMachineType),
Inertia = iepcData.Inertia * count, Inertia = iepcData.Inertia * count,
RatioPerGear = gearRatios.Select(x => x.Value).ToArray() RatioPerGear = _gearRatios.Select(x => x.Value).ToArray(),
//iepcEM.OverloadRegenerationFactor
//iepcEM.RatioADC //iepcEM.RatioADC
//iepcEM.TransmissionLossMap //iepcEM.TransmissionLossMap
//iepcEM.EMDragCurve //iepcEM.EMDragCurve
//iepcEM.Overload //iepcEM.Overload
}; };
return iepcEM; return iepcEM;
} }
private void InitData(IIEPCDeclarationInputData iepcData, IAxleGearInputData axleGear) private void InitData(IIEPCDeclarationInputData iepcData)
{ {
if (!iepcData.DifferentialIncluded) { if (iepcData.DifferentialIncluded) {
axleEfficiency = 1; _axleEfficiency = GenericAxleGearEfficiency;
axleRatio = 1; _axleRatio = 1;
} else { } else {
axleEfficiency = axleGear.Efficiency; _axleEfficiency = 1;
axleRatio = axleGear.Ratio; _axleRatio = 1;
} }
gearRatios = new Dictionary<int, double>(); _gearRatios = new Dictionary<int, double>();
foreach (var gear in iepcData.Gears.OrderBy(x => x.GearNumber)) { foreach (var gear in iepcData.Gears.OrderBy(x => x.GearNumber)) {
gearRatios.Add(gear.GearNumber, gear.Ratio); _gearRatios.Add(gear.GearNumber, gear.Ratio);
} }
gearRatioAtMeasurement = GetGearRatioAtMeasurement(); _gearRatioAtMeasurement = GetGearRatioAtMeasurement();
} }
private VoltageLevelData GetIEPCVoltageLevelData(IList<IElectricMotorVoltageLevel> voltageLevels, int count, ElectricMachineType electricMachineType) private VoltageLevelData GetIEPCVoltageLevelData(IList<IElectricMotorVoltageLevel> voltageLevels, int count, ElectricMachineType electricMachineType)
...@@ -99,7 +103,7 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -99,7 +103,7 @@ namespace TUGraz.VectoCore.Models.GenericModelData
private ElectricMotorFullLoadCurve GetElectricMotorFullLoadCurve(IElectricMotorVoltageLevel voltageLevel, private ElectricMotorFullLoadCurve GetElectricMotorFullLoadCurve(IElectricMotorVoltageLevel voltageLevel,
int count) int count)
{ {
return IEPCFullLoadCurveReader.Create(voltageLevel.FullLoadCurve, count, gearRatioAtMeasurement.Value); return IEPCFullLoadCurveReader.Create(voltageLevel.FullLoadCurve, count, _gearRatioAtMeasurement.Value);
} }
...@@ -108,12 +112,12 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -108,12 +112,12 @@ namespace TUGraz.VectoCore.Models.GenericModelData
{ {
var result = new Dictionary<uint, EfficiencyMap>(); var result = new Dictionary<uint, EfficiencyMap>();
foreach (var gearEntry in gearRatios) { foreach (var gearEntry in _gearRatios) {
var gearRatio = gearEntry.Value; var gearRatio = gearEntry.Value;
var ratedPoint = GenericRatedPointHelper.GetRatedPointOfFullLoadCurveAtIEPC(voltageLevel.FullLoadCurve, var ratedPoint = GenericRatedPointHelper.GetRatedPointOfFullLoadCurveAtIEPC(voltageLevel.FullLoadCurve,
axleRatio, gearRatioAtMeasurement.Value, GearEfficiency, axleEfficiency); _axleRatio, _gearRatioAtMeasurement.Value, GenericGearEfficiency, _axleEfficiency);
var deNormalizedMap = DeNormalizeData(GetNormalizedEfficiencyMap(electricMachineType), ratedPoint, gearRatio); var deNormalizedMap = DeNormalizeData(GetNormalizedEfficiencyMap(electricMachineType), ratedPoint, gearRatio);
result.Add((uint) gearEntry.Key, IEPCMapReader.Create(deNormalizedMap, count, gearRatio, fullLoadCurve)); result.Add((uint) gearEntry.Key, IEPCMapReader.Create(deNormalizedMap, count, gearRatio, fullLoadCurve));
...@@ -142,7 +146,7 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -142,7 +146,7 @@ namespace TUGraz.VectoCore.Models.GenericModelData
private KeyValuePair<int, double> GetGearRatioAtMeasurement() private KeyValuePair<int, double> GetGearRatioAtMeasurement()
{ {
var gear = gearRatios.Select(x => new { var gear = _gearRatios.Select(x => new {
Gear = x.Key, Gear = x.Key,
Ratio = x.Value, Ratio = x.Value,
Distance = Math.Abs(x.Value - 1) Distance = Math.Abs(x.Value - 1)
...@@ -161,13 +165,13 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -161,13 +165,13 @@ namespace TUGraz.VectoCore.Models.GenericModelData
foreach (DataRow row in normalizedMap.Rows) { foreach (DataRow row in normalizedMap.Rows) {
var torqueNormValue = row.ParseDouble(TorqueNorm); var torqueNormValue = row.ParseDouble(TorqueNorm);
var motorSpeed = row.ParseDouble(MotorSpeedNorm) * ratedPoint.NRated / gearRatio / axleRatio; var motorSpeed = row.ParseDouble(MotorSpeedNorm) * ratedPoint.NRated / gearRatio / _axleRatio;
var torque = torqueNormValue * ratedPoint.TRated * gearRatio * axleRatio * var torque = torqueNormValue * ratedPoint.TRated * gearRatio * _axleRatio *
( torqueNormValue > 0 ? GearEfficiency * axleEfficiency : 1 / GearEfficiency * axleEfficiency); ( torqueNormValue > 0 ? GenericGearEfficiency * _axleEfficiency : 1 / (GenericGearEfficiency * _axleEfficiency));
var powerElectrical = row.ParseDouble(PowerElectricalNorm) * ratedPoint.PRated; var powerElectrical = row.ParseDouble(PowerElectricalNorm) * ratedPoint.PRated;
var newRow = result.NewRow(); var newRow = result.NewRow();
newRow[ElectricMotorMapReader.Fields.MotorSpeed] = Math.Round(motorSpeed.Value(), 2, MidpointRounding.AwayFromZero).ToXMLFormat(2); newRow[ElectricMotorMapReader.Fields.MotorSpeed] = Math.Round(motorSpeed.AsRPM, 2, MidpointRounding.AwayFromZero).ToXMLFormat(2);
newRow[ElectricMotorMapReader.Fields.Torque] = Math.Round(torque.Value(), 2, MidpointRounding.AwayFromZero).ToXMLFormat(2); newRow[ElectricMotorMapReader.Fields.Torque] = Math.Round(torque.Value(), 2, MidpointRounding.AwayFromZero).ToXMLFormat(2);
newRow[ElectricMotorMapReader.Fields.PowerElectrical] = Math.Round(powerElectrical.Value(), 2, MidpointRounding.AwayFromZero).ToXMLFormat(2); newRow[ElectricMotorMapReader.Fields.PowerElectrical] = Math.Round(powerElectrical.Value(), 2, MidpointRounding.AwayFromZero).ToXMLFormat(2);
result.Rows.Add(newRow); result.Rows.Add(newRow);
...@@ -175,5 +179,67 @@ namespace TUGraz.VectoCore.Models.GenericModelData ...@@ -175,5 +179,67 @@ namespace TUGraz.VectoCore.Models.GenericModelData
return result; return result;
} }
}
private OverloadData CalculateOverloadData(IIEPCDeclarationInputData iepc, int count,
VoltageLevelData voltageLevel, Volt averageVoltage, Tuple<uint, double> gearRatioUsedForMeasurement)
{
// if average voltage is outside of the voltage-level range, do not extrapolate but take the min voltage entry, or max voltage entry
if (averageVoltage < iepc.VoltageLevels.Min(x => x.VoltageLevel))
{
return CalculateOverloadBuffer(iepc.VoltageLevels.First(), count, voltageLevel, gearRatioUsedForMeasurement);
}
if (averageVoltage > iepc.VoltageLevels.Max(x => x.VoltageLevel))
{
return CalculateOverloadBuffer(iepc.VoltageLevels.Last(), count, voltageLevel, gearRatioUsedForMeasurement);
}
var (vLow, vHigh) = iepc.VoltageLevels.OrderBy(x => x.VoltageLevel).GetSection(x => x.VoltageLevel < averageVoltage);
var ovlLo = CalculateOverloadBuffer(vLow, count, voltageLevel, gearRatioUsedForMeasurement);
var ovlHi = CalculateOverloadBuffer(vHigh, count, voltageLevel, gearRatioUsedForMeasurement);
var retVal = new OverloadData()
{
OverloadBuffer = VectoMath.Interpolate(vLow.VoltageLevel, vHigh.VoltageLevel, ovlLo.OverloadBuffer, ovlHi.OverloadBuffer, averageVoltage),
ContinuousTorque = VectoMath.Interpolate(vLow.VoltageLevel, vHigh.VoltageLevel, ovlLo.ContinuousTorque, ovlHi.ContinuousTorque, averageVoltage),
ContinuousPowerLoss = VectoMath.Interpolate(vLow.VoltageLevel, vHigh.VoltageLevel, ovlLo.ContinuousPowerLoss, ovlHi.ContinuousPowerLoss, averageVoltage)
};
return retVal;
}
private OverloadData CalculateOverloadBuffer(IElectricMotorVoltageLevel voltageEntry,
int count, VoltageLevelData voltageLevel, Tuple<uint, double> gearUsedForMeasurement = null)
{
var gearRatioUsedForMeasurement = gearUsedForMeasurement?.Item2 ?? 1.0;
var gear = new GearshiftPosition(gearUsedForMeasurement?.Item1 ?? 1);
var continuousTorque = voltageEntry.ContinuousTorque * count / gearRatioUsedForMeasurement;
var continuousTorqueSpeed = voltageEntry.ContinuousTorqueSpeed * gearRatioUsedForMeasurement;
var overloadTorque = (voltageEntry.OverloadTorque ?? 0.SI<NewtonMeter>()) * count / gearRatioUsedForMeasurement;
var overloadTestSpeed = (voltageEntry.OverloadTestSpeed ?? 0.RPMtoRad()) * gearRatioUsedForMeasurement;
var peakElPwr = voltageLevel.LookupElectricPower(voltageEntry.VoltageLevel,
overloadTestSpeed,
-overloadTorque,
gear,
true)
.ElectricalPower;
var peakPwrLoss = -peakElPwr - overloadTorque * overloadTestSpeed; // losses need to be positive
var contElPwr = voltageLevel.LookupElectricPower(voltageEntry.VoltageLevel, continuousTorqueSpeed,
-continuousTorque, gear).ElectricalPower ??
voltageLevel.LookupElectricPower(voltageEntry.VoltageLevel, continuousTorqueSpeed,
voltageLevel.FullLoadDriveTorque(voltageEntry.VoltageLevel, continuousTorqueSpeed),
gear, true).ElectricalPower;
var continuousPowerLoss = -contElPwr - continuousTorque * continuousTorqueSpeed; // loss needs to be positive
var overloadBuffer = (peakPwrLoss - continuousPowerLoss) * voltageEntry.OverloadTime;
return new OverloadData()
{
OverloadBuffer = overloadBuffer,
ContinuousTorque = continuousTorque,
ContinuousPowerLoss = continuousPowerLoss
};
}
}
} }
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