From 004e98db216cb282f4b9d490fcffd8849371b501 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Fri, 13 Nov 2020 09:37:26 +0100 Subject: [PATCH] cleanup comments --- .../Impl/AMTShiftStrategy.cs | 6 -- .../Impl/AMTShiftStrategyOptimized.cs | 5 +- .../Impl/ATShiftStrategy.cs | 59 +++---------------- .../Impl/ATShiftStrategyOptimized.cs | 15 +---- .../Impl/PEVAMTShiftStrategy.cs | 8 +-- 5 files changed, 14 insertions(+), 79 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs index 623a394fdb..f878ab3084 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs @@ -227,12 +227,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl _nextGear = CheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, gear, response); - //if ((ModelData.Gears[_nextGear].Ratio * outAngularVelocity - DataBus.EngineIdleSpeed) / - // (DataBus.EngineRatedSpeed - DataBus.EngineIdleSpeed) < - // Constants.SimulationSettings.ClutchClosingSpeedNorm && _nextGear > 1) { - // _nextGear--; - //} - return !_nextGear.Equals(gear); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs index f452bca7a4..66651105a8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs @@ -106,8 +106,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var vehicleSpeedPostShift = DataBus.VehicleInfo.VehicleSpeed - vDrop * shiftStrategyParameters.VelocityDropFactor; var totalTransmissionRatio = DataBus.EngineInfo.EngineSpeed / DataBus.VehicleInfo.VehicleSpeed; - //var totalTransmissionRatio = outAngularVelocity / DataBus.VehicleSpeed; - + for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { var tryNextGear = (uint)(currentGear.Gear + i); @@ -198,7 +197,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl minFCResponse = response; } - if (currentGear != minFcGear) { + if (!currentGear.Equals(minFcGear)) { return minFcGear; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs index e0d61dc973..7da8a76191 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs @@ -87,6 +87,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public ATShiftStrategy(IVehicleContainer dataBus) : base(dataBus) { EngineInertia = dataBus.RunData.EngineData?.Inertia ?? 0.SI<KilogramSquareMeter>(); + + if (Gears.Any(x => !x.TorqueConverterLocked.HasValue)) { + throw new VectoException("Gear list must have TC info for all gears! {0}", string.Join(", ", Gears)); + } } public override GearshiftPosition InitGear(Second absTime, Second dt, NewtonMeter torque, PerSecond outAngularVelocity) @@ -97,10 +101,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return Gears.First(); } - //var torqueConverterLocked = true; foreach (var gear in Gears.Reverse()) { - - //for (var gear = GearboxModelData.Gears.Keys.Max(); gear > 1; gear--) { var response = _gearbox.Initialize(gear, torque, outAngularVelocity); if (response.Engine.EngineSpeed > DataBus.EngineInfo.EngineRatedSpeed || response.Engine.EngineSpeed < DataBus.EngineInfo.EngineIdleSpeed) { @@ -254,8 +255,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // UPSHIFT - Special rule for 1C -> 2C - //var firstGear = Gears.First(); - //var secondGear = Gears.Count() > 1 ? Gears.Skip(1).First() : null; var nextGear = Gears.Successor(gear); if (!gear.TorqueConverterLocked.Value && nextGear != null && !nextGear.TorqueConverterLocked.Value && outAngularVelocity.IsGreater(0)) { var result = CheckUpshiftTcTc( @@ -393,22 +392,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl _nextGear.SetState(absTime, false, Gears.Successor(gear)); - //// C -> L: switch from torque converter to locked gear - //if (!_gearbox.TorqueConverterLocked && GearboxModelData.Gears[gear].HasLockedGear) { - // _nextGear.SetState(absTime, disengaged: false, gear: gear, tcLocked: true); - // return; - //} - - //// L -> L+1 - //// C -> C+1 - //if (GearboxModelData.Gears.ContainsKey(gear + 1)) { - // _nextGear.SetState(absTime, disengaged: false, gear: gear + 1, tcLocked: _gearbox.TorqueConverterLocked); - // return; - //} - - //// C -> L+1 -- not allowed!! - //throw new VectoSimulationException( - // "ShiftStrategy wanted to shift up, but current gear has active torque converter (C) but no locked gear (no L) and shifting directly to (L) is not allowed."); } [SuppressMessage("ReSharper", "UnusedParameter.Local")] @@ -428,12 +411,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl DataBus.DriverInfo.DriverAcceleration < 0.SI<MeterPerSquareSecond>()) { var tmpResponseCurr = (ResponseDryRun)_gearbox.Request(absTime, dt, outTorque, outAngularVelocity, true); if (_gearbox.Gear > Gears.First()) { + // clone current state of _nextgear, set gearbox state to lower gear, issue request, restore old gearbox state var tmp = _nextGear.Clone(); var gbxState = new NextGearState(absTime, _gearbox); tmp.Gear = Gears.Predecessor(_gearbox.Gear); SetGear(tmp); var tmpResponseDs = (ResponseDryRun)_gearbox.Request(absTime, dt, outTorque, outAngularVelocity, true); SetGear(gbxState); + // done if (tmpResponseDs.DeltaFullLoad - Formulas.InertiaPower( tmpResponseDs.Engine.EngineSpeed, DataBus.EngineInfo.EngineSpeed, EngineInertia, dt) < tmpResponseCurr.DeltaFullLoad) { Downshift(absTime, gear); @@ -487,23 +472,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl "ShiftStrategy wanted to shift down but no lower gear available."); } _nextGear.SetState(absTime, false, Gears.Predecessor(gear)); - - //// L -> C - //if (_gearbox.TorqueConverterLocked && GearboxModelData.Gears[gear].HasTorqueConverter) { - // _nextGear.SetState(absTime, disengaged: false, gear: gear, tcLocked: false); - // return; - //} - - //// L -> L-1 - //// C -> C-1 - //if (GearboxModelData.Gears.ContainsKey(gear - 1)) { - // _nextGear.SetState(absTime, disengaged: false, gear: gear - 1, tcLocked: _gearbox.TorqueConverterLocked); - // return; - //} - - //// L -> 0 -- not allowed!! - //throw new VectoSimulationException( - // "ShiftStrategy wanted to shift down but current gear is locked (L) and has no torque converter (C) and disenganging directly from (L) is not allowed."); } protected MeterPerSquareSecond EstimateAcceleration( @@ -517,7 +485,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var airDragLoss = DataBus.VehicleInfo.AirDragResistance(vehicleSpeed, vehicleSpeed) * DataBus.VehicleInfo.VehicleSpeed; var rollResistanceLoss = DataBus.VehicleInfo.RollingResistance(avgSlope) * DataBus.VehicleInfo.VehicleSpeed; - //DataBus.GearboxLoss(); var slopeLoss = DataBus.VehicleInfo.SlopeResistance(avgSlope) * DataBus.VehicleInfo.VehicleSpeed; var axleLoss = DataBus.AxlegearInfo.AxlegearLoss(); @@ -542,7 +509,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Second AbsTime { get; internal set; } public bool Disengaged { get; private set; } public GearshiftPosition Gear { get; internal set; } - //public bool TorqueConverterLocked; public NextGearState() { @@ -554,7 +520,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl AbsTime = nextGearState.AbsTime; Disengaged = nextGearState.Disengaged; Gear = nextGearState.Gear; - //TorqueConverterLocked = nextGearState.TorqueConverterLocked; } public NextGearState(Second absTime, ATGearbox gearbox) @@ -567,23 +532,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl AbsTime = absTime; Disengaged = disengaged; Gear = gear; - //TorqueConverterLocked = tcLocked; } - - //public void SetState(NextGearState state) - //{ - // AbsTime = state.AbsTime; - // Disengaged = state.Disengaged; - // Gear = state.Gear; - // //TorqueConverterLocked = state.TorqueConverterLocked; - //} - + public void SetState(Second absTime, ATGearbox gearbox) { AbsTime = absTime; Disengaged = gearbox.Disengaged; Gear = gearbox.Gear; - //TorqueConverterLocked = gearbox.TorqueConverterLocked; } public NextGearState Clone() diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs index 4fa23b9f52..f2661a971e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs @@ -28,8 +28,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private SimplePowertrainContainer TestContainer; private ATGearbox TestContainerGbx; - protected readonly GearList GearList; - private Kilogram vehicleMass; private Kilogram MinMass; private Kilogram MaxMass; @@ -65,7 +63,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl InitializeTestContainer(runData); - GearList = runData.GearboxData.GearList; } private void InitializeShiftlinesTCToLocked() @@ -147,7 +144,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter origInTorque, PerSecond origInAngularVelocity, GearshiftPosition currentGear, Second lastShiftTime, IResponse response) { - var next = GearList.Successor(currentGear); + var next = Gears.Successor(currentGear); if (currentGear.Gear == next.Gear && currentGear.TorqueConverterLocked != next.TorqueConverterLocked) { return CheckUpshiftFromTC( @@ -193,7 +190,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var airDragLoss = DataBus.VehicleInfo.AirDragResistance(vehicleSpeed, vehicleSpeed) * DataBus.VehicleInfo.VehicleSpeed; var rollResistanceLoss = DataBus.VehicleInfo.RollingResistance(avgSlope) * DataBus.VehicleInfo.VehicleSpeed; - //DataBus.GearboxLoss(); var slopeLoss = DataBus.VehicleInfo.SlopeResistance(avgSlope) * DataBus.VehicleInfo.VehicleSpeed; var axleLoss = DataBus.AxlegearInfo.AxlegearLoss(); @@ -241,8 +237,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl .Cast<PerSecond>(); var outTorqueEst = outTorque * outAngularVelocity / outAngularVelocityEst; - foreach (var next in GearList.IterateGears(GearList.Successor(currentGear), GearList.Successor(currentGear, (uint)shiftStrategyParameters.AllowedGearRangeFC))) { - //for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { + foreach (var next in Gears.IterateGears(Gears.Successor(currentGear), Gears.Successor(currentGear, (uint)shiftStrategyParameters.AllowedGearRangeFC))) { if (next == null) { // no further gear @@ -269,8 +264,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var response = RequestDryRunWithGear(absTime, dt, outTorqueEst, outAngularVelocityEst, next); - //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration, next); - if (!response.Engine.PowerRequest.IsSmaller(pNextGearMax)) { continue; } @@ -372,9 +365,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var current = currentGear; - foreach (var next in GearList.IterateGears(GearList.Predecessor(current), GearList.Predecessor(current, (uint)shiftStrategyParameters.AllowedGearRangeFC))) { - //for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { - //var next = GearList.Predecessor(currentGear, ); + foreach (var next in Gears.IterateGears(Gears.Predecessor(current), Gears.Predecessor(current, (uint)shiftStrategyParameters.AllowedGearRangeFC))) { if (next == null) { // no further gear continue; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs index fadc468956..5fcbf0e0da 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs @@ -257,9 +257,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var results = new List<Tuple<GearshiftPosition, double>>(); foreach (var tryNextGear in GearList.IterateGears(GearList.Successor(currentGear), GearList.Successor(currentGear, (uint)shiftStrategyParameters.AllowedGearRangeFC))) { - //for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { - //var tryNextGear = (uint)(currentGear + i); - + //if (tryNextGear > GearboxModelData.Gears.Keys.Max() // /*|| !(ModelData.Gears[tryNextGear].Ratio < shiftStrategyParameters.RatioEarlyUpshiftFC)*/) { // continue; @@ -471,9 +469,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var results = new List<Tuple<GearshiftPosition, double>>(); foreach (var tryNextGear in GearList.IterateGears(GearList.Predecessor(currentGear), GearList.Predecessor(currentGear, (uint)shiftStrategyParameters.AllowedGearRangeFC))) { - //for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { - //var tryNextGear = (uint)(currentGear - i); - + //if (tryNextGear < 1 /*|| !(ModelData.Gears[tryNextGear].Ratio <= shiftStrategyParameters.RatioEarlyDownshiftFC)*/) { // continue; //} -- GitLab