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
Verified Commit 9728ccb5 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

consider max torque in calculation of shift polygons

consider max speed and max torque in shift strategy (start gear, braking gear)
bugfix pev shift strategy: always use EM torque/speed when comparing with shift polygon
parent f6af645a
Branches
Tags
No related merge requests found
...@@ -43,6 +43,7 @@ using TUGraz.VectoCore.Configuration; ...@@ -43,6 +43,7 @@ using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.InputData.FileIO.JSON; using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.Impl; using TUGraz.VectoCore.InputData.Impl;
using TUGraz.VectoCore.InputData.Reader.ComponentData; using TUGraz.VectoCore.InputData.Reader.ComponentData;
using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter;
using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents; using TUGraz.VectoCore.InputData.Reader.DataObjectAdapter.SimulationComponents;
using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics;
using TUGraz.VectoCore.Models.Declaration.Auxiliaries; using TUGraz.VectoCore.Models.Declaration.Auxiliaries;
...@@ -972,9 +973,15 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -972,9 +973,15 @@ namespace TUGraz.VectoCore.Models.Declaration
} }
public static ShiftPolygon ComputeElectricMotorShiftPolygon(int gearIdx, public static ShiftPolygon ComputeElectricMotorShiftPolygon(int gearIdx,
ElectricMotorFullLoadCurve fullLoadCurve, double emRatio, IList<ITransmissionInputData> gears, ElectricMotorFullLoadCurve fullLoadCurveOrig, double emRatio, IList<ITransmissionInputData> gears,
double axlegearRatio, Meter dynamicTyreRadius, PerSecond downshiftMaxSpeed = null, PerSecond downshiftMinSpeed = null) double axlegearRatio, Meter dynamicTyreRadius, PerSecond downshiftMaxSpeed = null, PerSecond downshiftMinSpeed = null)
{ {
var gbxMaxTq = gears[gearIdx].MaxTorque != null ? gears[gearIdx].MaxTorque / emRatio : null;
var gbxMaxSpeed = gears[gearIdx].MaxInputSpeed != null ? gears[gearIdx].MaxInputSpeed * emRatio : null;
var fullLoadCurve = gbxMaxTq == null
? fullLoadCurveOrig
: LimitElectricMotorFullLoadCurve(fullLoadCurveOrig, gbxMaxTq);
if (gears.Count < 2) { if (gears.Count < 2) {
throw new VectoException("ComputeShiftPolygon needs at least 2 gears. {0} gears given.", gears.Count); throw new VectoException("ComputeShiftPolygon needs at least 2 gears. {0} gears given.", gears.Count);
} }
...@@ -985,20 +992,41 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -985,20 +992,41 @@ namespace TUGraz.VectoCore.Models.Declaration
var nMax = downshiftMaxSpeed ?? fullLoadCurve.NP80low; var nMax = downshiftMaxSpeed ?? fullLoadCurve.NP80low;
var nMin = downshiftMinSpeed ?? 0.1 * fullLoadCurve.RatedSpeed; var nMin = downshiftMinSpeed ?? 0.1 * fullLoadCurve.RatedSpeed;
downShift.AddRange(DownshiftLineDrive(fullLoadCurve, nMin, fullLoadCurve.NP80low)); downShift.AddRange(DownshiftLineDrive(fullLoadCurve, fullLoadCurveOrig, nMin, fullLoadCurve.NP80low));
downShift.AddRange(DownshiftLineDrag(fullLoadCurve, nMin, nMax)); downShift.AddRange(DownshiftLineDrag(fullLoadCurve, fullLoadCurveOrig, nMin, nMax));
} }
if (gearIdx >= gears.Count - 1) { if (gearIdx >= gears.Count - 1) {
return new ShiftPolygon(downShift, upShift); return new ShiftPolygon(downShift, upShift);
} }
upShift.Add(new ShiftPolygon.ShiftPolygonEntry(fullLoadCurve.MaxGenerationTorque * 1.1, fullLoadCurve.MaxSpeed * 0.9)); upShift.Add(new ShiftPolygon.ShiftPolygonEntry(fullLoadCurve.MaxGenerationTorque * 1.1, VectoMath.Min(fullLoadCurve.MaxSpeed * 0.9, gbxMaxSpeed)));
upShift.Add(new ShiftPolygon.ShiftPolygonEntry(fullLoadCurve.MaxDriveTorque * 1.1, fullLoadCurve.MaxSpeed * 0.9)); upShift.Add(new ShiftPolygon.ShiftPolygonEntry(fullLoadCurve.MaxDriveTorque * 1.1, VectoMath.Min(fullLoadCurve.MaxSpeed * 0.9, gbxMaxSpeed)));
return new ShiftPolygon(downShift, upShift); return new ShiftPolygon(downShift, upShift);
} }
private static List<ShiftPolygon.ShiftPolygonEntry> DownshiftLineDrive(ElectricMotorFullLoadCurve fullLoadCurve, PerSecond nMin, PerSecond nMax) public static ElectricMotorFullLoadCurve LimitElectricMotorFullLoadCurve(ElectricMotorFullLoadCurve emFld, NewtonMeter maxTq)
{
var contTqFld = new ElectricMotorFullLoadCurve(new List<ElectricMotorFullLoadCurve.FullLoadEntry>() {
new ElectricMotorFullLoadCurve.FullLoadEntry() {
MotorSpeed = 0.RPMtoRad(),
FullDriveTorque = -maxTq,
FullGenerationTorque = maxTq
},
new ElectricMotorFullLoadCurve.FullLoadEntry() {
MotorSpeed = 1.1 * emFld.MaxSpeed,
FullDriveTorque = -maxTq,
FullGenerationTorque = maxTq
}
});
var limitedFld = AbstractSimulationDataAdapter.IntersectEMFullLoadCurves(emFld, contTqFld);
return limitedFld;
}
private static List<ShiftPolygon.ShiftPolygonEntry> DownshiftLineDrive(
ElectricMotorFullLoadCurve fullLoadCurve, ElectricMotorFullLoadCurve fullLoadCurveOrig,
PerSecond nMin, PerSecond nMax)
{ {
var retVal = new List<ShiftPolygon.ShiftPolygonEntry>(); var retVal = new List<ShiftPolygon.ShiftPolygonEntry>();
var downShiftPoints = fullLoadCurve var downShiftPoints = fullLoadCurve
...@@ -1012,7 +1040,7 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -1012,7 +1040,7 @@ namespace TUGraz.VectoCore.Models.Declaration
// coarse grid points in FLD // coarse grid points in FLD
retVal.Add( retVal.Add(
new ShiftPolygon.ShiftPolygonEntry( new ShiftPolygon.ShiftPolygonEntry(
fullLoadCurve.MaxDriveTorque * 1.1, fullLoadCurveOrig.MaxDriveTorque * 1.1,
nMax)); nMax));
retVal.Add( retVal.Add(
new ShiftPolygon.ShiftPolygonEntry( new ShiftPolygon.ShiftPolygonEntry(
...@@ -1026,7 +1054,7 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -1026,7 +1054,7 @@ namespace TUGraz.VectoCore.Models.Declaration
} else { } else {
retVal.Add( retVal.Add(
new ShiftPolygon.ShiftPolygonEntry( new ShiftPolygon.ShiftPolygonEntry(
fullLoadCurve.MaxDriveTorque * 1.1, fullLoadCurveOrig.MaxDriveTorque * 1.1,
nMax)); nMax));
if (downShiftPoints.Max(x => x.X) < nMax) { if (downShiftPoints.Max(x => x.X) < nMax) {
retVal.Add( retVal.Add(
...@@ -1050,7 +1078,9 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -1050,7 +1078,9 @@ namespace TUGraz.VectoCore.Models.Declaration
return retVal; return retVal;
} }
private static List<ShiftPolygon.ShiftPolygonEntry> DownshiftLineDrag(ElectricMotorFullLoadCurve fullLoadCurve, PerSecond nMin, PerSecond nMax) private static List<ShiftPolygon.ShiftPolygonEntry> DownshiftLineDrag(
ElectricMotorFullLoadCurve fullLoadCurve, ElectricMotorFullLoadCurve fullLoadCurveOrig,
PerSecond nMin, PerSecond nMax)
{ {
var retVal = new List<ShiftPolygon.ShiftPolygonEntry>(); var retVal = new List<ShiftPolygon.ShiftPolygonEntry>();
var downShiftPoints = fullLoadCurve var downShiftPoints = fullLoadCurve
...@@ -1072,7 +1102,7 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -1072,7 +1102,7 @@ namespace TUGraz.VectoCore.Models.Declaration
nMax)); nMax));
retVal.Add( retVal.Add(
new ShiftPolygon.ShiftPolygonEntry( new ShiftPolygon.ShiftPolygonEntry(
fullLoadCurve.MaxGenerationTorque * 1.1, fullLoadCurveOrig.MaxGenerationTorque * 1.1,
nMax)); nMax));
} else { } else {
if (downShiftPoints.Min(x => x.X) > nMin) { if (downShiftPoints.Min(x => x.X) > nMin) {
...@@ -1094,7 +1124,7 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -1094,7 +1124,7 @@ namespace TUGraz.VectoCore.Models.Declaration
} }
retVal.Add( retVal.Add(
new ShiftPolygon.ShiftPolygonEntry( new ShiftPolygon.ShiftPolygonEntry(
fullLoadCurve.MaxGenerationTorque * 1.1, fullLoadCurveOrig.MaxGenerationTorque * 1.1,
nMax)); nMax));
} }
......
...@@ -8,6 +8,7 @@ using TUGraz.VectoCore.Models.Connector.Ports; ...@@ -8,6 +8,7 @@ using TUGraz.VectoCore.Models.Connector.Ports;
using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Connector.Ports.Impl;
using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.Simulation.Impl;
using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Strategies; using TUGraz.VectoCore.Models.SimulationComponent.Strategies;
using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData;
...@@ -155,7 +156,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -155,7 +156,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse DoHandleRequest(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, public IResponse DoHandleRequest(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
bool dryRun, double ratio) bool dryRun, double ratio)
{ {
var gear = DataBus.GearboxInfo?.Gear ?? new GearshiftPosition(1); var gear = DataBus.GearboxInfo?.Gear ?? new GearshiftPosition(1);
if (gear.Gear == 0) { if (gear.Gear == 0) {
gear = new GearshiftPosition(1); gear = new GearshiftPosition(1);
...@@ -434,7 +434,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -434,7 +434,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected virtual PerSecond GetMotorSpeedLimit(Second absTime) protected virtual PerSecond GetMotorSpeedLimit(Second absTime)
{ {
if (DataBus.GearboxInfo.Gear.Gear == 0) { if (DataBus.GearboxInfo == null || DataBus.GearboxInfo.Gear.Gear == 0) {
return MaxSpeed; return MaxSpeed;
} }
......
...@@ -181,53 +181,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -181,53 +181,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
} }
//#region Implementation of IShiftPolygonCalculator
//public ShiftPolygon ComputeDeclarationShiftPolygon(GearboxType gearboxType, int i, EngineFullLoadCurve engineDataFullLoadCurve,
// IList<ITransmissionInputData> gearboxGears, CombustionEngineData engineData, double axlegearRatio, Meter dynamicTyreRadius,
// ElectricMotorData electricMotorData = null)
//{
// if (electricMotorData == null) {
// throw new VectoException("ElectricMotorData is required to calculate Shift Polygon!");
// }
// var emFld = electricMotorData.EfficiencyData.VoltageLevels.First().FullLoadCurve;
// return ComputeDeclarationShiftPolygon(i, gearboxGears, axlegearRatio, dynamicTyreRadius, electricMotorData,
// _shiftStrategyParameters.PEV_DownshiftSpeedFactor.LimitTo(0, 1) * emFld.RatedSpeed, _shiftStrategyParameters.PEV_DownshiftMinSpeedFactor * emFld.RatedSpeed);
//}
//private ShiftPolygon ComputeDeclarationShiftPolygon(int i,
// IList<ITransmissionInputData> gearboxGears, double axlegearRatio,
// Meter dynamicTyreRadius,
// ElectricMotorData electricMotorData, PerSecond downshiftMaxSpeed, PerSecond downshiftMinSpeed)
//{
// return DeclarationData.Gearbox.ComputeElectricMotorShiftPolygon(i,
// electricMotorData.EfficiencyData.VoltageLevels.First().FullLoadCurve, electricMotorData.RatioADC,
// gearboxGears, axlegearRatio, dynamicTyreRadius, downshiftMaxSpeed, downshiftMinSpeed);
//}
//#endregion
protected internal Dictionary<uint, ShiftPolygon> CalculateDeratedShiftLines(ElectricMotorData em, protected internal Dictionary<uint, ShiftPolygon> CalculateDeratedShiftLines(ElectricMotorData em,
IList<ITransmissionInputData> gearData, Meter rDyn, double axleGearRatio, GearboxType gearboxType) IList<ITransmissionInputData> gearData, Meter rDyn, double axleGearRatio, GearboxType gearboxType)
{ {
var retVal = new Dictionary<uint, ShiftPolygon>(); var retVal = new Dictionary<uint, ShiftPolygon>();
for (var i = 0u; i < gearData.Count; i++) { for (var i = 0u; i < gearData.Count; i++) {
var emFld = em.EfficiencyData.VoltageLevels.First().FullLoadCurve; var emFld = em.EfficiencyData.VoltageLevels.First().FullLoadCurve;
var contTqFld = new ElectricMotorFullLoadCurve(new List<ElectricMotorFullLoadCurve.FullLoadEntry>() { var contTq = em.Overload.ContinuousTorque;
new ElectricMotorFullLoadCurve.FullLoadEntry() { var limitedFld = DeclarationData.Gearbox.LimitElectricMotorFullLoadCurve(emFld, contTq);
MotorSpeed = 0.RPMtoRad(),
FullDriveTorque = -em.Overload.ContinuousTorque,
FullGenerationTorque = em.Overload.ContinuousTorque
},
new ElectricMotorFullLoadCurve.FullLoadEntry() {
MotorSpeed = 1.1 * emFld.MaxSpeed,
FullDriveTorque = -em.Overload.ContinuousTorque,
FullGenerationTorque = em.Overload.ContinuousTorque
}
});
var limitedFld = AbstractSimulationDataAdapter.IntersectEMFullLoadCurves(emFld, contTqFld);
var limitedEm = new ElectricMotorData() { var limitedEm = new ElectricMotorData() {
EfficiencyData = new VoltageLevelData() { EfficiencyData = new VoltageLevelData() {
VoltageLevels = new List<ElectricMotorVoltageLevelData>() { VoltageLevels = new List<ElectricMotorVoltageLevelData>() {
...@@ -235,9 +196,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -235,9 +196,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
FullLoadCurve = limitedFld FullLoadCurve = limitedFld
} }
} }
} },
RatioADC = em.RatioADC,
}; };
var shiftPolygon = _shiftPolygonImplementation.ComputeDeclarationShiftPolygon((int)i, var shiftPolygon = _shiftPolygonImplementation.ComputeDeclarationShiftPolygon((int)i,
gearData, axleGearRatio, gearData, axleGearRatio,
rDyn, limitedEm, _shiftStrategyParameters.PEV_DeRatedDownshiftSpeedFactor * emFld.RatedSpeed, rDyn, limitedEm, _shiftStrategyParameters.PEV_DeRatedDownshiftSpeedFactor * emFld.RatedSpeed,
...@@ -248,6 +209,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -248,6 +209,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
return retVal; return retVal;
} }
#region Implementation of IShiftStrategy #region Implementation of IShiftStrategy
public bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, public bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque,
...@@ -486,7 +449,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -486,7 +449,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
break; break;
} }
var maxTorque = VectoMath.Min(-resp.ElectricMotor.MaxDriveTorque, var maxTorque = VectoMath.Min(resp.ElectricMotor.MaxDriveTorque == null ? null : - resp.ElectricMotor.MaxDriveTorque,
!nextGear.Equals(GearList.First()) !nextGear.Equals(GearList.First())
? GearboxModelData.Gears[nextGear.Gear].ShiftPolygon ? GearboxModelData.Gears[nextGear.Gear].ShiftPolygon
.InterpolateDownshift(resp.Engine.EngineSpeed) .InterpolateDownshift(resp.Engine.EngineSpeed)
...@@ -531,21 +494,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -531,21 +494,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
var ratio = gear.IsLockedGear() var ratio = gear.IsLockedGear()
? GearboxModelData.Gears[gear.Gear].Ratio ? GearboxModelData.Gears[gear.Gear].Ratio
: GearboxModelData.Gears[gear.Gear].TorqueConverterRatio; : GearboxModelData.Gears[gear.Gear].TorqueConverterRatio;
candidates[gear] = gbxOutSpeed * ratio; var gbxInSpeed = gbxOutSpeed * ratio;
if (GearboxModelData.Gears[gear.Gear].MaxSpeed != null && gbxInSpeed.IsGreater(GearboxModelData.Gears[gear.Gear].MaxSpeed)) {
continue;
}
candidates[gear] = gbxInSpeed;
} }
var ratedSpeed = VoltageLevels.VoltageLevels.First().FullLoadCurve.RatedSpeed; var ratedSpeed = VoltageLevels.VoltageLevels.First().FullLoadCurve.RatedSpeed;
var maxSpeedNorm = VoltageLevels.MaxSpeed / ratedSpeed; var maxSpeedNorm = VoltageLevels.MaxSpeed / ratedSpeed;
var targetMotor = (_shiftStrategyParameters.PEV_TargetSpeedBrakeNorm * (maxSpeedNorm - 1) + 1) * ratedSpeed; var targetMotor = (_shiftStrategyParameters.PEV_TargetSpeedBrakeNorm * (maxSpeedNorm - 1) + 1) * ratedSpeed;
if (candidates.Any(x => x.Value > targetMotor && x.Value < VoltageLevels.MaxSpeed)) { if (candidates.Any(x => x.Value > targetMotor / EMRatio && x.Value < VoltageLevels.MaxSpeed / EMRatio)) {
var best = candidates.Where(x => x.Value > targetMotor && x.Value < VoltageLevels.MaxSpeed) var best = candidates.Where(x => x.Value > targetMotor / EMRatio && x.Value < VoltageLevels.MaxSpeed / EMRatio)
.OrderBy(x => x.Value).First(); .OrderBy(x => x.Value).First();
return best.Key; return best.Key;
} }
if (candidates.Any(x => x.Value < VoltageLevels.MaxSpeed)) if (candidates.Any(x => x.Value < VoltageLevels.MaxSpeed / EMRatio))
return candidates.Where(x => x.Value < VoltageLevels.MaxSpeed).MaxBy(x => x.Value).Key; return candidates.Where(x => x.Value < VoltageLevels.MaxSpeed / EMRatio).MaxBy(x => x.Value).Key;
else { else {
return candidates.MaxBy(x => x.Value).Key; return candidates.MaxBy(x => x.Value).Key;
} }
...@@ -573,6 +540,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -573,6 +540,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
continue; continue;
} }
if (GearboxModelData.Gears[tryNextGear.Gear].MaxSpeed != null && inAngularVelocity.IsGreater(GearboxModelData.Gears[tryNextGear.Gear].MaxSpeed)) {
continue;
}
var fcNext = GetFCRating(response); var fcNext = GetFCRating(response);
results.Add(Tuple.Create(tryNextGear, fcNext)); results.Add(Tuple.Create(tryNextGear, fcNext));
} }
...@@ -747,7 +718,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies ...@@ -747,7 +718,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl.Shiftstrategies
var reserve = 1 - (response.ElectricMotor.TorqueRequestEmMap ?? 0.SI<NewtonMeter>()) / response.ElectricMotor.MaxDriveTorqueEM; var reserve = 1 - (response.ElectricMotor.TorqueRequestEmMap ?? 0.SI<NewtonMeter>()) / response.ElectricMotor.MaxDriveTorqueEM;
var isBelowDownshift = gear.Gear > 1 && var isBelowDownshift = gear.Gear > 1 &&
IsBelowDownshiftCurve(GearboxModelData.Gears[gear.Gear].ShiftPolygon, response.ElectricMotor.TorqueRequest, IsBelowDownshiftCurve(GearboxModelData.Gears[gear.Gear].ShiftPolygon, -response.ElectricMotor.TorqueRequestEmMap,
response.ElectricMotor.AngularVelocity); response.ElectricMotor.AngularVelocity);
if (reserve >= GearshiftParams.StartTorqueReserve && !isBelowDownshift) { if (reserve >= GearshiftParams.StartTorqueReserve && !isBelowDownshift) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment