diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index 47f43c18a93b0b0028ac565f27628ddbee180940..7f843902032a9b698935a105c8d4b35c9895a527 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -287,16 +287,14 @@ Imports VectoAuxiliaries ' ReSharper disable once UnusedMember.Global -- used via Logging Framework! Public Shared Sub LogMethod(level As String, message As String) - Try + If VectoWorkerV3.IsBusy AndAlso Not VectoWorkerV3.CancellationPending Then If level = "Warn" Then VectoWorkerV3.ReportProgress(100, New VectoProgress With {.Target = "ListBoxWarning", .Message = message}) ElseIf level = "Error" Or level = "Fatal" Then VectoWorkerV3.ReportProgress(100, New VectoProgress With {.Target = "ListBoxError", .Message = message}) End If - Catch e As InvalidOperationException - - End Try + End If End Sub 'Declaration mode GUI settings diff --git a/VectoCommon/VectoCommon/Utils/SI.cs b/VectoCommon/VectoCommon/Utils/SI.cs index c51e9f87f2489d9535db969240c1bdb28d0f66f8..a3ea8a013314f5b4cd14ae57ed4d8bff7b6c2808 100644 --- a/VectoCommon/VectoCommon/Utils/SI.cs +++ b/VectoCommon/VectoCommon/Utils/SI.cs @@ -756,9 +756,6 @@ namespace TUGraz.VectoCommon.Utils private NewtonMeterSecond(double val) : base(val, NumeratorDefault) {} } - /// <summary> - /// - /// </summary> public class Ampere : SIBase<Ampere> { private static readonly Unit[] NumeratorDefault = { Unit.Ampere }; @@ -785,9 +782,6 @@ namespace TUGraz.VectoCommon.Utils } } - /// <summary> - /// - /// </summary> public class Volt : SIBase<Volt> { private static readonly Unit[] NumeratorDefault = { Unit.Volt }; @@ -1018,6 +1012,7 @@ namespace TUGraz.VectoCommon.Utils /// <remarks> /// Usage: new SI(1.0).Newton.Meter, new SI(2.3).Rounds.Per.Minute /// </remarks> + [DebuggerDisplay("{Val}")] public class SI : IComparable { /// <summary> diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs index 9bd7dd089366f0afb594ab00dfff82f5a82de1f4..84585fab8fce943d575f3f721968ea78d494d8f8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs @@ -140,10 +140,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Log.Debug("engine speed would fall below idle speed - shift down"); return true; } - if (inAngularVelocity.IsGreaterOrEqual(DataBus.EngineRatedSpeed) && Data.Gears.ContainsKey(gear + 1)) { - NextGear.SetState(absTime, false, gear + 1, Data.Gears[gear + 1].HasLockedGear); + if (inAngularVelocity.IsGreaterOrEqual(DataBus.EngineRatedSpeed)) { Log.Debug("engine speed would be above rated speed - shift up"); - return true; + if (Data.Gears.ContainsKey(gear + 1) && (_gearbox.TorqueConverterLocked || Data.Gears[gear + 1].HasTorqueConverter)) { + // 1L -> 2C/L OR 1C -> 2C + NextGear.SetState(absTime, false, gear + 1, !Data.Gears[gear + 1].HasTorqueConverter); + return true; + } + if (Data.Gears[gear].HasLockedGear) { + // 1C -> 1L + NextGear.SetState(absTime, false, gear, true); + return true; + } + + // 1C -> ? + throw new VectoSimulationException( + "AngularVelocity is higher than EngineRatedSpeed, Current gear has active torque converter (1C) but no locked gear (no 1L) and shifting directly to 2L is not allowed."); } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 503426de7d635ca4d112e04995a75fe9e3dd5930..70992e53f1513cca5b2fc39f9539181be199dc1e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -408,7 +408,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient); }). Case<ResponseSpeedLimitExceeded>(() => { response = Driver.DrivingActionBrake(absTime, ds, velocity, gradient); }); - }); + }). + Case<ResponseOverload>(r => { response = Driver.DrivingActionCoast(absTime, ds, velocity, gradient); }); } else { if (DataBus.VehicleSpeed.IsSmallerOrEqual(0.SI<MeterPerSecond>())) { // the clutch is disengaged, and the vehicle stopped - we can't perform a roll action. wait for the clutch to be engaged @@ -626,23 +627,30 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl gradient, targetDistance: targetDistance); response.Switch(). Case<ResponseOverload>(r => { - Log.Info("Got OverloadResponse during brake action - desired deceleration could not be reached! response: {0}", r); + Log.Info( + "Brake -> Got OverloadResponse during brake action - desired deceleration could not be reached! response: {0}", + r); if (!DataBus.ClutchClosed(absTime)) { - Log.Info("Clutch is open - trying RollAction"); + Log.Info("Brake -> Overload -> Clutch is open - Trying roll action"); response = Driver.DrivingActionRoll(absTime, ds, targetVelocity, gradient); } else { - Log.Info("Clutch is closed - trying AccelerateAction"); - response = Driver.DrivingActionAccelerate(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); - response.Switch().Case<ResponseGearShift>( - rs => { - Log.Info("Got GearShift response, performing roll action..."); - response = Driver.DrivingActionRoll(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); - } - ); + Log.Info("Brake -> Overload -> Clutch is closed - Trying brake action again"); + response = Driver.DrivingActionBrake(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient, + targetDistance: targetDistance); + response.Switch(). + Case<ResponseOverload>(r1 => { + Log.Info("Brake -> Overload -> 2nd Brake -> Overload -> Trying accelerate action"); + response = Driver.DrivingActionAccelerate(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); + response.Switch().Case<ResponseGearShift>( + rs => { + Log.Info("Brake -> Overload -> 2nd Brake -> Accelerate -> Got GearShift response, performing roll action"); + response = Driver.DrivingActionRoll(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); + }); + }); } }). Case<ResponseGearShift>(r => { - Log.Info("Got GearShift response, performing roll action..."); + Log.Info("Brake -> Got GearShift response, performing roll action"); response = Driver.DrivingActionRoll(absTime, ds, DriverStrategy.BrakeTrigger.NextTargetSpeed, gradient); }); break; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs index 28237ca525f4c4d6b885dc4fea7c05a04c4431b4..fe71ed58426420a0f4088d8e04f302095f6d3898 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs @@ -91,6 +91,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed) { PreviousState.AngularSpeed = angularSpeed; + if (angularSpeed.IsEqual(0)) + return 0.SI<NewtonMeter>(); + return ComputePowerDemand(angularSpeed) / angularSpeed; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs index cfea47dc021e01a3b1a7ffe9afe7a05a441d1715..a5a6ed33a8e4b536a4c41da742f1c3622df033f8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs @@ -133,10 +133,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } - if (ShiftStrategy.ShiftRequired(absTime, dt, outTorque * ratio, outAngularVelocity / ratio, operatingPoint.InTorque, - operatingPoint.InAngularVelocity, Gearbox.Gear, Gearbox.LastShift)) { - return new ResponseGearShift() { Source = this }; - } CurrentState.SetState(operatingPoint.InTorque, operatingPoint.InAngularVelocity, outTorque, outAngularVelocity); CurrentState.OperatingPoint = operatingPoint; var retVal = NextComponent.Request(absTime, dt, operatingPoint.InTorque, operatingPoint.InAngularVelocity);