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

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

Merge pull request #362 in VECTO/vecto-sim from...

Merge pull request #362 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-436-at-gearbox-simulation-aborts to develop

* commit '37ed7c6c':
  combustion engine: validate power demand on commit (not during normal request)
  double the delta value when searching operating point for tc + engine combined (safety margin for final engine operating point)
  combustion engine: remove unnecessary call of update engine state, (fails if engine drag torque == 0 for low speed)
  at shift strategy: upshift 1C -> 2C only if gbx speed > 0
  AT Model: improve shifting: don't disengage only when halt is intended, torque converter: decision on max-power/drag power depends on driving behavior
  modContainer extension methods: add default values for aggregates
  Reset braking power before next search
parents 15c146ac 37ed7c6c
No related branches found
No related tags found
No related merge requests found
......@@ -191,7 +191,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
if (!dryRun &&
((DataBus.VehicleStopped && outAngularVelocity > 0) ||
(CurrentState.Disengaged && outTorque.IsGreater(0)))) {
(CurrentState.Disengaged && outTorque.IsGreater(0, 1e-3)))) {
Gear = 1;
CurrentState.TorqueConverterLocked = false;
LastShift = absTime;
......@@ -224,6 +224,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
outTorque * (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0
};
_requestAfterGearshift = true;
LastShift = absTime;
} else {
loop = true;
Gear = _strategy.Engage(absTime, dt, outTorque, outAngularVelocity);
......
......@@ -135,7 +135,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// 3) 1C -> 0: disengange when negative T_out and positive T_in
var gear1C = gear == 1 && !_gearbox.TorqueConverterLocked;
var disengageTOutNegativeAndTInPositive = gear1C && outTorque.IsSmaller(0) && inTorque.IsGreater(0);
var disengageTOutNegativeAndTInPositive = DataBus.DriverAcceleration <= 0 && gear1C && outTorque.IsSmaller(0) && inTorque.IsGreater(0);
var disengageTCEngineSpeedLowerIdle = braking && torqueNegative && gear1C &&
inAngularVelocity.IsSmallerOrEqual(DataBus.EngineIdleSpeed);
......@@ -225,7 +225,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// UPSHIFT - Special rule for 1C -> 2C
if (!_gearbox.TorqueConverterLocked && ModelData.Gears.ContainsKey(gear + 1) &&
ModelData.Gears[gear + 1].HasTorqueConverter) {
ModelData.Gears[gear + 1].HasTorqueConverter && outAngularVelocity.IsGreater(0)) {
// C -> C+1
var nextGear = ModelData.Gears[gear + 1];
var gearRatio = nextGear.TorqueConverterRatio / currentGear.TorqueConverterRatio;
......
......@@ -200,7 +200,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
Log.Debug("Dynamic FullLoad: torque: {0}, power: {1}", dynamicFullLoadTorque, dynamicFullLoadPower);
ValidatePowerDemand(totalTorqueDemand); // requires CurrentState.FullDragTorque and DynamicfullLoad to be set!
//ValidatePowerDemand(totalTorqueDemand, dynamicFullLoadTorque, fullDragTorque);
// get max. torque as limited by gearbox. gearbox only limits torqueOut!
var gearboxFullLoad = DataBus.GearMaxTorque;
......@@ -277,7 +277,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
//UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
return new ResponseSuccess {
EnginePowerRequest = totalTorqueDemand * avgEngineSpeed,
......@@ -328,16 +328,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
/// <summary>
/// Validates the requested power demand [W].
/// </summary>
protected virtual void ValidatePowerDemand(NewtonMeter torqueDemand)
protected virtual void ValidatePowerDemand(NewtonMeter torqueDemand, NewtonMeter dynamicFullLoadTorque,
NewtonMeter fullDragTorque)
{
if (CurrentState.FullDragTorque >= 0 && torqueDemand < 0) {
if (fullDragTorque.IsGreater(0) && torqueDemand < 0) {
throw new VectoSimulationException("P_engine_drag > 0! Tq_drag: {0}, Tq_eng: {1}, n_eng_avg: {2} [1/min] ",
CurrentState.FullDragTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
fullDragTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
}
if (CurrentState.DynamicFullLoadTorque <= 0 && torqueDemand > 0) {
if (dynamicFullLoadTorque <= 0 && torqueDemand > 0) {
throw new VectoSimulationException("P_engine_full < 0! Tq_full: {0}, Tq_eng: {1}, n_eng_avg: {2} [1/min] ",
CurrentState.DynamicFullLoadTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
dynamicFullLoadTorque, torqueDemand, CurrentState.EngineSpeed.AsRPM);
}
}
......@@ -347,8 +348,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected override void DoWriteModalResults(IModalDataContainer container)
{
ValidatePowerDemand(CurrentState.EngineTorque, CurrentState.DynamicFullLoadTorque, CurrentState.FullDragTorque);
var avgEngineSpeed = (PreviousState.EngineSpeed + CurrentState.EngineSpeed) / 2.0;
if (avgEngineSpeed.IsSmaller(EngineIdleSpeed, DataBus.ExecutionMode == ExecutionMode.Engineering ? 20.RPMtoRad():1e-3.RPMtoRad())) {
if (avgEngineSpeed.IsSmaller(EngineIdleSpeed,
DataBus.ExecutionMode == ExecutionMode.Engineering ? 20.RPMtoRad() : 1e-3.RPMtoRad())) {
Log.Warn("EngineSpeed below idling speed! n_eng_avg: {0}, n_idle: {1}", avgEngineSpeed, EngineIdleSpeed);
}
container[ModalResultField.P_eng_fcmap] = CurrentState.EngineTorque * avgEngineSpeed;
......
......@@ -674,6 +674,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
response = Driver.DrivingActionRoll(absTime, ds, targetVelocity, gradient);
} else {
Log.Info("Brake -> Overload -> Clutch is closed - Trying brake action again");
DataBus.BrakePower = 0.SI<Watt>();
response = Driver.DrivingActionBrake(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient,
targetDistance: targetDistance);
response.Switch().
......@@ -745,8 +746,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public Meter ActionDistance
{
get
{
get {
return VectoMath.Min(CoastingStartDistance ?? double.MaxValue.SI<Meter>(),
BrakingStartDistance ?? double.MaxValue.SI<Meter>());
}
......
......@@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var dynamicFullLoadPower = ComputeFullLoadPower(avgEngineSpeed, dt, dryRun);
CurrentState.DynamicFullLoadTorque = dynamicFullLoadPower / avgEngineSpeed;
ValidatePowerDemand(totalTorqueDemand);
ValidatePowerDemand(totalTorqueDemand, CurrentState.DynamicFullLoadTorque, CurrentState.FullDragTorque);
CurrentState.EngineTorque = LimitEnginePower(CurrentState.EngineTorque, avgEngineSpeed, absTime);
......@@ -83,7 +83,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
};
}
UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
//UpdateEngineState(CurrentState.EnginePower, avgEngineSpeed);
CurrentState.EngineTorque = CurrentState.EnginePower / CurrentState.EngineSpeed;
......
......@@ -111,7 +111,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
//if (false && DataBus.VehicleStopped && DataBus.DriverBehavior == DrivingBehavior.Driving && outTorque.IsGreater(0)) {
// dryOperatingPoint = ModelData.FindOperatingPoint(DataBus.EngineIdleSpeed, outAngularVelocity);
//} else {
dryOperatingPoint = outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0)
dryOperatingPoint = (DataBus.DriverBehavior != DrivingBehavior.Braking) ||
(outTorque.IsGreater(0) && DataBus.BrakePower.IsEqual(0))
? GetMaxPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
PreviousState.InTorque * PreviousState.InAngularVelocity)
: GetDragPowerOperatingPoint(dt, outAngularVelocity, engineResponse,
......@@ -122,15 +123,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
return new ResponseDryRun {
Source = this,
DeltaFullLoad = delta,
DeltaDragLoad = delta,
DeltaFullLoad = 2 * delta,
DeltaDragLoad = 2 * delta,
TorqueConverterOperatingPoint = dryOperatingPoint
};
}
// normal request
var ratio = Gearbox.GetGearData(Gearbox.Gear).TorqueConverterRatio;
// check if out-side of the operating point is equal to requested values
if (!outAngularVelocity.IsEqual(operatingPoint.OutAngularVelocity) || !outTorque.IsEqual(operatingPoint.OutTorque)) {
......@@ -151,6 +150,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var retVal = NextComponent.Request(absTime, dt, inTorque, operatingPoint.InAngularVelocity);
// check if shift is required
var ratio = Gearbox.GetGearData(Gearbox.Gear).TorqueConverterRatio;
if (retVal is ResponseSuccess &&
ShiftStrategy.ShiftRequired(absTime, dt, outTorque * ratio, outAngularVelocity / ratio, inTorque,
operatingPoint.InAngularVelocity, Gearbox.Gear, Gearbox.LastShift)) {
......
......@@ -152,7 +152,7 @@ namespace TUGraz.VectoCore.OutputData
{
var accelerationTimeShare = data.Data.Rows.Cast<DataRow>()
.Select(x => new {
a = x.Field<MeterPerSquareSecond>((int)ModalResultField.acc),
a = x.Field<MeterPerSquareSecond>((int)ModalResultField.acc).DefaultIfNull(0),
dt = x.Field<Second>((int)ModalResultField.simulationInterval)
})
.Sum(x => x.a > 0.125 ? x.dt : 0.SI<Second>()).DefaultIfNull(0);
......@@ -163,7 +163,7 @@ namespace TUGraz.VectoCore.OutputData
{
var decelerationTimeShare = data.Data.Rows.Cast<DataRow>()
.Select(x => new {
a = x.Field<MeterPerSquareSecond>((int)ModalResultField.acc),
a = x.Field<MeterPerSquareSecond>((int)ModalResultField.acc).DefaultIfNull(0),
dt = x.Field<Second>((int)ModalResultField.simulationInterval)
})
.Sum(x => x.a < -0.125 ? x.dt : 0.SI<Second>()).DefaultIfNull(0);
......@@ -174,8 +174,8 @@ namespace TUGraz.VectoCore.OutputData
{
var cruiseTime = data.Data.Rows.Cast<DataRow>()
.Select(x => new {
v = x.Field<MeterPerSecond>((int)ModalResultField.v_act),
a = x.Field<MeterPerSquareSecond>((int)ModalResultField.acc),
v = x.Field<MeterPerSecond>((int)ModalResultField.v_act).DefaultIfNull(0),
a = x.Field<MeterPerSquareSecond>((int)ModalResultField.acc).DefaultIfNull(0),
dt = x.Field<Second>((int)ModalResultField.simulationInterval)
})
.Sum(x => x.v >= 0.1.KMPHtoMeterPerSecond() && x.a.IsBetween(-0.125, 0.125) ? x.dt : 0.SI<Second>())
......@@ -187,7 +187,7 @@ namespace TUGraz.VectoCore.OutputData
{
var stopTime = data.Data.Rows.Cast<DataRow>()
.Select(x => new {
v = x.Field<MeterPerSecond>((int)ModalResultField.v_act),
v = x.Field<MeterPerSecond>((int)ModalResultField.v_act).DefaultIfNull(0),
dt = x.Field<Second>((int)ModalResultField.simulationInterval)
})
.Sum(x => x.v < 0.1.KMPHtoMeterPerSecond() ? x.dt : 0.SI<Second>()) ?? 0.SI<Second>();
......
......@@ -58,6 +58,7 @@ namespace TUGraz.VectoCore.Tests.Reports
for (var i = 0; i < 499; i++) {
modData[ModalResultField.simulationInterval] = 1.SI<Second>();
modData[ModalResultField.n_eng_avg] = 600.RPMtoRad();
modData[ModalResultField.v_act] = 20.KMPHtoMeterPerSecond();
modData[ModalResultField.drivingBehavior] = DrivingBehavior.Driving;
modData[ModalResultField.time] = i.SI<Second>();
modData[ModalResultField.dist] = i.SI<Meter>();
......@@ -119,6 +120,7 @@ namespace TUGraz.VectoCore.Tests.Reports
modData[ModalResultField.time] = i.SI<Second>();
modData[ModalResultField.dist] = i.SI<Meter>();
modData[ModalResultField.n_eng_avg] = 600.RPMtoRad();
modData[ModalResultField.v_act] = 20.KMPHtoMeterPerSecond();
modData[ModalResultField.drivingBehavior] = DrivingBehavior.Driving;
modData["FAN"] = powerDemand[i % powerDemand.Length];
modData[ModalResultField.P_air] = powerDemand[i % powerDemand.Length];
......
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