diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index c152421464be85fe2a571d7145b64e5f5c1a5dc6..a4c2a59a1f4f42cf3d96d1db8aa3f83c9894a6b6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -849,7 +849,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl velocityWithOverspeed = DriverStrategy.ApplyOverspeed(velocityWithOverspeed); } - if (DataBus.GearboxInfo.GearboxType.AutomaticTransmission() || (DataBus.ClutchInfo.ClutchClosed(absTime) &&DataBus.GearboxInfo.GearEngaged(absTime) )) { + if (DataBus.GearboxInfo.GearboxType.AutomaticTransmission() || (DataBus.ClutchInfo.ClutchClosed(absTime) && DataBus.GearboxInfo.GearEngaged(absTime) )) { for (var i = 0; i < 3; i++) { var retVal = HandleRequestEngaged( absTime, ds, targetVelocity, gradient, prohibitOverspeed, velocityWithOverspeed, debug); @@ -1414,7 +1414,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Radian gradient) { IResponse response; - if (DataBus.GearboxInfo.GearboxType.AutomaticTransmission() || DataBus.ClutchInfo.ClutchClosed(absTime)) { + if (DataBus.GearboxInfo.GearboxType.AutomaticTransmission() || (DataBus.ClutchInfo.ClutchClosed(absTime) && DataBus.GearboxInfo.GearEngaged(absTime))) { if (DataBus.VehicleInfo.VehicleSpeed.IsGreater(0)) { response = Driver.DrivingActionAccelerate(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); } else { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 47251a9c80f65a39968c2128bf65f3181da328da..09de255a867b1a3ab83dfd3d41a3024954c0117e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -246,7 +246,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (firstResponse.DeltaDragLoad.IsGreater(0)) { // braking requested but engine operating point is not below drag curve. - if (ElectricMotorCanPropellDuringTractionInterruption || DataBus.GearboxInfo.GearEngaged(absTime)) { + if (ElectricMotorCanPropellDuringTractionInterruption) { + if (DataBus.GearboxInfo.GearEngaged(absTime)) { + eval.AddRange(FindSolution(absTime, dt, outTorque, outAngularVelocity, dryRun)); + } else { + EvaluateConfigsForGear( + absTime, dt, outTorque, outAngularVelocity, currentGear, AllowICEOff(absTime), eval, emPos); + } + }else if (DataBus.GearboxInfo.GearEngaged(absTime)) { eval.AddRange(FindSolution(absTime, dt, outTorque, outAngularVelocity, dryRun)); } else { eval.Add(ResponseEmOff); @@ -409,7 +416,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies EvaluateConfigsForGear( absTime, dt, outTorque, outAngularVelocity, best.Gear + 1, AllowICEOff(absTime), newEval, best.Setting.MechanicalAssistPower.First().Key); - best = DoSelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); + if (newEval.Count > 0) { + best = DoSelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); + } } if (best.IgnoreReason.EngineSpeedBelowDownshift()) { //try downshift @@ -417,7 +426,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies EvaluateConfigsForGear( absTime, dt, outTorque, outAngularVelocity, best.Gear - 1, AllowICEOff(absTime), newEval, best.Setting.MechanicalAssistPower.First().Key); - best = DoSelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); + if (newEval.Count > 0) { + best = DoSelectBestOption(newEval, absTime, dt, outTorque, outAngularVelocity, dryRun, currentGear); + } } return best; } @@ -450,6 +461,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return best; } + var allOverload = eval.Where(x => !(x.IgnoreReason.BatteryDemandExceeded() || x.IgnoreReason.BatterySoCTooLow())) .All(x => x.IgnoreReason.EngineTorqueDemandTooHigh()); var allUnderload = eval.All(x => x.IgnoreReason.EngineTorqueDemandTooLow()); @@ -653,11 +665,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var minimumShiftTimePassed = (DataBus.GearboxInfo.LastShift + ModelData.GearboxData.ShiftTime).IsSmallerOrEqual(absTime); var gearRangeUpshift = ModelData.GearshiftParameters.AllowedGearRangeUp; var gearRangeDownshift = ModelData.GearshiftParameters.AllowedGearRangeDown; - if (dryRun || !minimumShiftTimePassed || (absTime - DataBus.GearboxInfo.LastUpshift).IsSmaller(ModelData.GearboxData.DownshiftAfterUpshiftDelay) + if (dryRun || !minimumShiftTimePassed || (absTime - DataBus.GearboxInfo.LastUpshift).IsSmaller(ModelData.GearboxData.DownshiftAfterUpshiftDelay/*, 0.1*/) || (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && DataBus.VehicleInfo.VehicleSpeed.IsSmaller(5.KMPHtoMeterPerSecond()))) { gearRangeDownshift = 0; } - if (dryRun || !minimumShiftTimePassed || (absTime - DataBus.GearboxInfo.LastDownshift).IsSmaller(ModelData.GearboxData.UpshiftAfterDownshiftDelay) + if (dryRun || !minimumShiftTimePassed || (absTime - DataBus.GearboxInfo.LastDownshift).IsSmaller(ModelData.GearboxData.UpshiftAfterDownshiftDelay/*,0.1*/) || (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && DataBus.VehicleInfo.VehicleSpeed.IsSmaller(5.KMPHtoMeterPerSecond()))) { gearRangeUpshift = 0; }