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

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

fixes in hybrid strategy: allow ice off if engine speed is outside range

hybrid controller: re-evaluate hybrid strategy if gear changed during re-engage
parent 20922fef
No related branches found
No related tags found
No related merge requests found
...@@ -91,19 +91,31 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl ...@@ -91,19 +91,31 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity,
bool dryRun = false) bool dryRun = false)
{ {
var strategySettings = Strategy.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); var retry = false;
ApplyStrategySettings(strategySettings); var retryCount = 0;
if (!dryRun) { IResponse retVal;
CurrentState.SetState(outTorque, outAngularVelocity, outTorque, outAngularVelocity); do {
CurrentState.StrategyResponse = strategySettings; retry = false;
} var strategySettings = Strategy.Request(absTime, dt, outTorque, outAngularVelocity, dryRun);
if (!dryRun && /*!DataBus.EngineInfo.EngineOn &&*/ strategySettings.ShiftRequired) { ApplyStrategySettings(strategySettings);
DataBus.GearboxCtl.TriggerGearshift(absTime, dt); if (!dryRun) {
_shiftStrategy.SetNextGear(strategySettings.NextGear); CurrentState.SetState(outTorque, outAngularVelocity, outTorque, outAngularVelocity);
return new ResponseGearShift(this); CurrentState.StrategyResponse = strategySettings;
} }
var retVal = NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); if (!dryRun && /*!DataBus.EngineInfo.EngineOn &&*/ strategySettings.ShiftRequired) {
retVal.HybridController.StrategySettings = strategySettings; DataBus.GearboxCtl.TriggerGearshift(absTime, dt);
_shiftStrategy.SetNextGear(strategySettings.NextGear);
return new ResponseGearShift(this);
}
retVal = NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, dryRun);
retVal.HybridController.StrategySettings = strategySettings;
if (!(retVal is ResponseSuccess) && retVal.Gearbox.Gear != strategySettings.EvaluatedSolution.Gear && retryCount < 3) {
retryCount++;
retry = true;
}
} while (retry);
return retVal; return retVal;
} }
......
...@@ -246,6 +246,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -246,6 +246,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
return; return;
} }
if (firstResponse.ElectricMotor.MaxRecuperationTorque == null) {
eval.Add(ResponseEmOff);
return;
}
var maxRecuperation = new HybridStrategyResponse() { var maxRecuperation = new HybridStrategyResponse() {
CombustionEngineOn = DataBus.EngineInfo.EngineOn, // AllowICEOff(absTime), CombustionEngineOn = DataBus.EngineInfo.EngineOn, // AllowICEOff(absTime),
GearboxInNeutral = false, GearboxInNeutral = false,
...@@ -276,7 +281,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -276,7 +281,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
var emRecuperationTq = SearchAlgorithm.Search( var emRecuperationTq = SearchAlgorithm.Search(
maxRecuperationResponse.ElectricMotor.ElectricMotorPowerMech / maxRecuperationResponse.ElectricMotor.ElectricMotorPowerMech /
maxRecuperationResponse.ElectricMotor.AngularVelocity, maxRecuperationResponse.ElectricMotor.AngularVelocity,
maxRecuperationResponse.Engine.TorqueOutDemand, maxRecuperationResponse.ElectricMotor.MaxDriveTorque * 0.1, maxRecuperationResponse.Engine.TorqueOutDemand, maxRecuperationResponse.ElectricMotor.MaxRecuperationTorque * 0.1,
getYValue: r => { getYValue: r => {
var response = r as ResponseDryRun; var response = r as ResponseDryRun;
return response.DeltaDragLoad; return response.DeltaDragLoad;
...@@ -376,7 +381,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -376,7 +381,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
{ {
var best = eval.Where(x => !double.IsNaN(x.Score)).OrderBy(x => x.Score).FirstOrDefault(); var best = eval.Where(x => !double.IsNaN(x.Score)).OrderBy(x => x.Score).FirstOrDefault();
if (best == null) { if (best == null) {
best = eval.OrderBy(x => Math.Abs((int)currentGear - x.Gear)).FirstOrDefault(x => !DataBus.EngineCtl.CombustionEngineOn || !x.IgnoreReason.InvalidEngineSpeed()); best = eval.OrderBy(x => Math.Abs((int)currentGear - x.Gear)).FirstOrDefault(
x => !DataBus.EngineCtl.CombustionEngineOn || !x.IgnoreReason.InvalidEngineSpeed());
if (best == null /*&& dryRun*/) { if (best == null /*&& dryRun*/) {
var emEngaged = (!ElectricMotorCanPropellDuringTractionInterruption || var emEngaged = (!ElectricMotorCanPropellDuringTractionInterruption ||
(DataBus.GearboxInfo.GearEngaged(absTime) && eval.First().Response.Gearbox.Gear != 0)); (DataBus.GearboxInfo.GearEngaged(absTime) && eval.First().Response.Gearbox.Gear != 0));
...@@ -401,9 +407,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -401,9 +407,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
} }
} }
if ((DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate // || if ((DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate // ||
/*DataBus.DriverInfo.DrivingAction == DrivingAction.Brake*/) && allUnderload) { /*DataBus.DriverInfo.DrivingAction == DrivingAction.Brake*/) && allUnderload) {
if (ElectricMotorCanPropellDuringTractionInterruption || DataBus.GearboxInfo.GearEngaged(absTime)) { if (ElectricMotorCanPropellDuringTractionInterruption || DataBus.GearboxInfo.GearEngaged(absTime)) {
var filtered = eval.Where(x => !x.IgnoreReason.InvalidEngineSpeed()).OrderBy(x => Math.Abs((int)currentGear - x.Gear)).ToArray(); var filtered = eval.Where(x => !x.IgnoreReason.InvalidEngineSpeed())
.OrderBy(x => Math.Abs((int)currentGear - x.Gear)).ToArray();
if (!filtered.Any()) { if (!filtered.Any()) {
filtered = eval.OrderBy(x => Math.Abs((int)currentGear - x.Gear)).ToArray(); filtered = eval.OrderBy(x => Math.Abs((int)currentGear - x.Gear)).ToArray();
} }
...@@ -411,6 +418,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -411,6 +418,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
x => x.Setting.MechanicalAssistPower.Sum(e => e.Value ?? 0.SI<NewtonMeter>())); x => x.Setting.MechanicalAssistPower.Sum(e => e.Value ?? 0.SI<NewtonMeter>()));
} }
} }
} else {
} }
return best; return best;
} }
...@@ -697,16 +706,27 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -697,16 +706,27 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
TestPowertrain.Gearbox._nextGear = Controller.ShiftStrategy.NextGear; TestPowertrain.Gearbox._nextGear = Controller.ShiftStrategy.NextGear;
} }
TestPowertrain.CombustionEngine.PreviousState.EngineOn = (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineOn; //if (!PreviousState.GearboxEngaged) {
TestPowertrain.CombustionEngine.PreviousState.EnginePower = (DataBus.EngineInfo as CombustionEngine).PreviousState.EnginePower; TestPowertrain.CombustionEngine.PreviousState.EngineOn =
TestPowertrain.CombustionEngine.PreviousState.dt = (DataBus.EngineInfo as CombustionEngine).PreviousState.dt; (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineOn;
TestPowertrain.CombustionEngine.PreviousState.EngineSpeed = (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineSpeed; TestPowertrain.CombustionEngine.PreviousState.EnginePower =
TestPowertrain.CombustionEngine.PreviousState.EngineTorque = (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorque; (DataBus.EngineInfo as CombustionEngine).PreviousState.EnginePower;
TestPowertrain.CombustionEngine.PreviousState.EngineTorqueOut = (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorqueOut; TestPowertrain.CombustionEngine.PreviousState.dt = (DataBus.EngineInfo as CombustionEngine).PreviousState.dt;
TestPowertrain.CombustionEngine.PreviousState.DynamicFullLoadTorque = (DataBus.EngineInfo as CombustionEngine).PreviousState.DynamicFullLoadTorque; TestPowertrain.CombustionEngine.PreviousState.EngineSpeed =
(DataBus.EngineInfo as CombustionEngine).PreviousState.EngineSpeed;
TestPowertrain.Clutch.PreviousState.InAngularVelocity = TestPowertrain.CombustionEngine.PreviousState.EngineTorque =
(DataBus.ClutchInfo as SwitchableClutch).PreviousState.InAngularVelocity; (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorque;
TestPowertrain.CombustionEngine.PreviousState.EngineTorqueOut =
(DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorqueOut;
TestPowertrain.CombustionEngine.PreviousState.DynamicFullLoadTorque =
(DataBus.EngineInfo as CombustionEngine).PreviousState.DynamicFullLoadTorque;
TestPowertrain.Gearbox.PreviousState.InAngularVelocity =
(DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity;
TestPowertrain.Clutch.PreviousState.InAngularVelocity =
(DataBus.ClutchInfo as SwitchableClutch).PreviousState.InAngularVelocity;
//}
if (/*nextGear != DataBus.GearboxInfo.Gear && */TestPowertrain.ElectricMotorP2 != null) { if (/*nextGear != DataBus.GearboxInfo.Gear && */TestPowertrain.ElectricMotorP2 != null) {
TestPowertrain.ElectricMotorP2.PreviousState.OutAngularVelocity = TestPowertrain.ElectricMotorP2.PreviousState.OutAngularVelocity =
...@@ -758,15 +778,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies ...@@ -758,15 +778,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
tmp.IgnoreReason |= HybridConfigurationIgnoreReason.EngineSpeedBelowDownshift; tmp.IgnoreReason |= HybridConfigurationIgnoreReason.EngineSpeedBelowDownshift;
} }
if (!double.IsNaN(tmp.FuelCosts)) { if (allowIceOff && resp.Engine.TorqueOutDemand.IsEqual(0)) {
if (allowIceOff && resp.Engine.TorqueOutDemand.IsEqual(0)) { // no torque from ICE requested, ICE could be turned off
// no torque from ICE requested, ICE could be turned off tmp.FuelCosts = 0;
tmp.FuelCosts = 0; tmp.ICEOff = true;
tmp.ICEOff = true; } else {
} else { if (!double.IsNaN(tmp.FuelCosts)) {
tmp.FuelCosts = ModelData.EngineData.Fuels.Sum( //if (!allowIceOff || !resp.Engine.TorqueOutDemand.IsEqual(0)) {
x => (x.ConsumptionMap.GetFuelConsumptionValue(resp.Engine.TotalTorqueDemand, resp.Engine.EngineSpeed) tmp.FuelCosts = ModelData.EngineData.Fuels.Sum(
* x.FuelData.LowerHeatingValueVecto * dt).Value()); x => (x.ConsumptionMap.GetFuelConsumptionValue(resp.Engine.TotalTorqueDemand, resp.Engine.EngineSpeed)
* x.FuelData.LowerHeatingValueVecto * dt).Value());
//}
} }
} }
tmp.BatCosts = -(resp.ElectricSystem.BatteryPowerDemand * dt).Value(); tmp.BatCosts = -(resp.ElectricSystem.BatteryPowerDemand * dt).Value();
......
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