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

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

prevent engine off during gearshift

parent 59f1c0be
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
public bool GearboxEngaged;
public Second ICEStartTStmp { get; set; }
public Second GearshiftTriggerTstmp { get; set; }
}
private VectoRunData ModelData;
......@@ -235,8 +237,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
}
}
var retVal = CreateResponse(best, currentGear);
if (!DataBus.EngineInfo.EngineOn && !best.ICEOff && retVal.ShiftRequired) {
CurrentState.ICEStartTStmp = absTime + dt;
......@@ -256,6 +256,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
DryRunResult = best;
}
if (retVal.ShiftRequired) {
CurrentState.GearshiftTriggerTstmp = absTime;
}
DebugData.Add(new { Evaluations = eval, Best = best, RetVal = retVal, DryRun = dryRun });
return retVal;
}
......@@ -294,8 +298,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
private List<HybridResultEntry> FindSolution(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun)
{
var allowICEOff = PreviousState.ICEStartTStmp == null ||
PreviousState.ICEStartTStmp.IsSmaller(absTime + MIN_ICE_ON_TIME);
var duringTractionInterruption = (PreviousState.GearshiftTriggerTstmp + ModelData.GearboxData.TractionInterruption).IsGreaterOrEqual(absTime);
var allowICEOff = (PreviousState.ICEStartTStmp == null ||
PreviousState.ICEStartTStmp.IsSmaller(absTime + MIN_ICE_ON_TIME)) && !duringTractionInterruption;
var emPos = ModelData.ElectricMachinesData.First().Item1;
var responses = new List<HybridResultEntry>();
......@@ -664,6 +669,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
}
PreviousState.AngularVelocity = outAngularVelocity;
PreviousState.GearshiftTriggerTstmp = -double.MaxValue.SI<Second>();
CurrentState.GearshiftTriggerTstmp = -double.MaxValue.SI<Second>();
return retVal;
}
......@@ -672,6 +679,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies
PreviousState = CurrentState;
CurrentState = new StrategyState();
CurrentState.ICEStartTStmp = PreviousState.ICEStartTStmp;
CurrentState.GearshiftTriggerTstmp = PreviousState.GearshiftTriggerTstmp;
DebugData = new DebugData();
DryRunAction = null;
DryRunResult = null;
......
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