diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs index 7194de96034eede666c648428e7a4fcb9243b571..d5f7bf73c303658107085d49b9e619dbfe1aef9e 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapterHeavyLorry.cs @@ -469,14 +469,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { retVal.Inertia = DeclarationData.Gearbox.Inertia; retVal.TractionInterruption = retVal.Type.TractionInterruption(); - retVal.TorqueReserve = DeclarationData.GearboxTCU.TorqueReserve; - retVal.StartTorqueReserve = DeclarationData.GearboxTCU.TorqueReserveStart; - retVal.ShiftTime = DeclarationData.Gearbox.MinTimeBetweenGearshifts; - retVal.StartSpeed = DeclarationData.GearboxTCU.StartSpeed; - retVal.StartAcceleration = DeclarationData.GearboxTCU.StartAcceleration; - retVal.DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay; - retVal.UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay; - retVal.UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration; + } public virtual AxleGearData CreateAxleGearData(IAxleGearInputData data) @@ -695,8 +688,16 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter public virtual ShiftStrategyParameters CreateGearshiftData(GearboxData gbx, double axleRatio, PerSecond engineIdlingSpeed) { var retVal = new ShiftStrategyParameters { - StartVelocity = DeclarationData.GearboxTCU.StartSpeed, + TorqueReserve = DeclarationData.GearboxTCU.TorqueReserve, + StartTorqueReserve = DeclarationData.GearboxTCU.TorqueReserveStart, + TimeBetweenGearshifts = DeclarationData.Gearbox.MinTimeBetweenGearshifts, + StartSpeed = DeclarationData.GearboxTCU.StartSpeed, StartAcceleration = DeclarationData.GearboxTCU.StartAcceleration, + DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, + UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, + UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, + + StartVelocity = DeclarationData.GearboxTCU.StartSpeed, GearResidenceTime = DeclarationData.GearboxTCU.GearResidenceTime, DnT99L_highMin1 = DeclarationData.GearboxTCU.DnT99L_highMin1, DnT99L_highMin2 = DeclarationData.GearboxTCU.DnT99L_highMin2, diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 488da9e14cd1612a433d8d14a64ba7d92ce58c51..fafe8ad1d931d6bc7f30aa9dcd840037093cad00 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -388,14 +388,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter { retVal.Inertia = gearbox.Type.ManualTransmission() ? gearbox.Inertia : 0.SI<KilogramSquareMeter>(); retVal.TractionInterruption = gearbox.TractionInterruption; - retVal.TorqueReserve = gearshiftData.TorqueReserve; - retVal.StartTorqueReserve = gearshiftData.StartTorqueReserve; - retVal.ShiftTime = gearshiftData.MinTimeBetweenGearshift; - retVal.StartSpeed = gearshiftData.StartSpeed; - retVal.StartAcceleration = gearshiftData.StartAcceleration; - retVal.DownshiftAfterUpshiftDelay = gearshiftData.DownshiftAfterUpshiftDelay; - retVal.UpshiftAfterDownshiftDelay = gearshiftData.UpshiftAfterDownshiftDelay; - retVal.UpshiftMinAcceleration = gearshiftData.UpshiftMinAcceleration; + } public AxleGearData CreateAxleGearData(IAxleGearInputData data) @@ -552,6 +545,14 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter } var retVal = new ShiftStrategyParameters { + TorqueReserve = gsInputData.TorqueReserve, + StartTorqueReserve = gsInputData.StartTorqueReserve, + TimeBetweenGearshifts = gsInputData.MinTimeBetweenGearshift, + StartSpeed = gsInputData.StartSpeed, + DownshiftAfterUpshiftDelay = gsInputData.DownshiftAfterUpshiftDelay, + UpshiftAfterDownshiftDelay = gsInputData.UpshiftAfterDownshiftDelay, + UpshiftMinAcceleration = gsInputData.UpshiftMinAcceleration, + StartVelocity = gsInputData.StartSpeed ?? DeclarationData.GearboxTCU.StartSpeed, StartAcceleration = gsInputData.StartAcceleration ?? DeclarationData.GearboxTCU.StartAcceleration, GearResidenceTime = gsInputData.GearResidenceTime ?? DeclarationData.GearboxTCU.GearResidenceTime, diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs b/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs index 1bf1e399dedc5c30b8146c6d5045e02a2c1e61a6..031243119acc527d46102f117a22560324a66427 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ShiftStrategyParameters.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent.Data.ShiftStrategy; @@ -9,7 +10,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data { { public MeterPerSecond StartVelocity { get; internal set; } - public MeterPerSquareSecond StartAcceleration { get; internal set; } + //public MeterPerSquareSecond StartAcceleration { get; internal set; } public Second GearResidenceTime { get; internal set; } @@ -23,6 +24,38 @@ namespace TUGraz.VectoCore.Models.Simulation.Data { public IAccelerationReserveLookup AccelerationReserveLookup { get; internal set; } + [Required, Range(0, 0.5)] + public double TorqueReserve { get; internal set; } + + /// <summary> + /// Gets the minimum time between shifts. + /// </summary> + [Required, SIRange(0, 5)] + public Second TimeBetweenGearshifts { get; internal set; } + + /// <summary> + /// [%] (0-1) The starting torque reserve for finding the starting gear after standstill. + /// </summary> + [Required, Range(0, 0.5)] + public double StartTorqueReserve { get; internal set; } + + // MQ: TODO: move to Driver Data ? + [Required, SIRange(double.Epsilon, 5)] + public MeterPerSecond StartSpeed { get; internal set; } + + // MQ: TODO: move to Driver Data ? + [Required, SIRange(double.Epsilon, 2)] + public MeterPerSquareSecond StartAcceleration { get; internal set; } + + [Required, SIRange(0, double.MaxValue)] + public Second UpshiftAfterDownshiftDelay { get; internal set; } + + [Required, SIRange(0, double.MaxValue)] + public Second DownshiftAfterUpshiftDelay { get; internal set; } + + [Required, SIRange(0, double.MaxValue)] + public MeterPerSquareSecond UpshiftMinAcceleration { get; internal set; } + //% Max.acceptable engine speed for current gear //% Low limit, if demanded cardan torque for /constant/ velocity is not above //% the max.available cardan torque diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs index 2c2325016c41d3ebc493575f1ce5b683d13c630d..918a953bf717a58779973e48f7b4c49979d50432 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs @@ -52,9 +52,9 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus bool TCLocked { get; } - MeterPerSecond StartSpeed { get; } + //MeterPerSecond StartSpeed { get; } - MeterPerSquareSecond StartAcceleration { get; } + //MeterPerSquareSecond StartAcceleration { get; } Watt GearboxLoss(); diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 37f2941d55cdbfe1d2f2e66fa704b5c658d57e2c..5f31b2148ebcdcfdd8dbd13b444fd1c3ab544298 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -687,6 +687,11 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl powertrain.AddComponent(engine, idleController) .AddAuxiliaries(container, data); + if (data.ElectricMachinesData.Any(x => x.Item1 == PowertrainPosition.HybridP1)) { + if (gearbox is ATGearbox atGbx) { + atGbx.IdleController = idleController; + } + } } public void BuildSimplePowertrainE2(VectoRunData data, VehicleContainer container) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs index 204f3eb3f88c581f9ca640fdc4dded01e558dee4..e81dd683cefb905413c92723ded4f430db47e1cb 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs @@ -66,37 +66,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data /// <summary> /// [%] (0-1) The torque reserve for shift strategy (early upshift, skipgears) /// </summary> - [Required, Range(0, 0.5)] - public double TorqueReserve { get; internal set; } // todo: move to shift parameters - - /// <summary> - /// Gets the minimum time between shifts. - /// </summary> - [Required, SIRange(0, 5)] - public Second ShiftTime { get; internal set; } // todo: move to shift parameters - - /// <summary> - /// [%] (0-1) The starting torque reserve for finding the starting gear after standstill. - /// </summary> - [Required, Range(0, 0.5)] - public double StartTorqueReserve { get; internal set; } // todo: move to shift parameters - - // MQ: TODO: move to Driver Data ? - [Required, SIRange(double.Epsilon, 5)] - public MeterPerSecond StartSpeed { get; internal set; } // todo: move to shift parameters - - // MQ: TODO: move to Driver Data ? - [Required, SIRange(double.Epsilon, 2)] - public MeterPerSquareSecond StartAcceleration { get; internal set; } // todo: move to shift parameters - - [Required, SIRange(0, double.MaxValue)] - public Second UpshiftAfterDownshiftDelay { get; internal set; } // todo: move to shift parameters - - [Required, SIRange(0, double.MaxValue)] - public Second DownshiftAfterUpshiftDelay { get; internal set; } // todo: move to shift parameters - - [Required, SIRange(0, double.MaxValue)] - public MeterPerSquareSecond UpshiftMinAcceleration { get; internal set; } // todo: move to shift parameters + [SIRange(0.5, 1)] public Second PowershiftShiftTime { get; internal set; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs index 0206bd5b9593fe27c5d074964bbb0eeaf8a67855..0a55c2a4053e6d2a26e4d06485825b4a3049bb5f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs @@ -67,8 +67,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl runData.VehicleData.DynamicTyreRadius; var minEngineSpeed = (runData.EngineData.FullLoadCurves[0].RatedSpeed - runData.EngineData.IdleSpeed) * Constants.SimulationSettings.ClutchClosingSpeedNorm + runData.EngineData.IdleSpeed; - foreach (var gearData in ModelData.Gears.Reverse()) { - if (ModelData.StartSpeed * transmissionRatio * gearData.Value.Ratio > minEngineSpeed) { + foreach (var gearData in GearboxModelData.Gears.Reverse()) { + if (GearshiftParams.StartSpeed * transmissionRatio * gearData.Value.Ratio > minEngineSpeed) { MaxStartGear = gearData.Key; break; } @@ -77,13 +77,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private bool SpeedTooLowForEngine(uint gear, PerSecond outAngularSpeed) { - return (outAngularSpeed * ModelData.Gears[gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); + return (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); } private bool SpeedTooHighForEngine(uint gear, PerSecond outAngularSpeed) { return - (outAngularSpeed * ModelData.Gears[gear].Ratio).IsGreaterOrEqual(VectoMath.Min(ModelData.Gears[gear].MaxSpeed, + (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsGreaterOrEqual(VectoMath.Min(GearboxModelData.Gears[gear].MaxSpeed, DataBus.EngineInfo.EngineN95hSpeed)); } @@ -107,7 +107,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl while (_nextGear > 1 && SpeedTooLowForEngine(_nextGear, outAngularVelocity)) { _nextGear--; } - while (_nextGear < ModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { + while (_nextGear < GearboxModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { _nextGear++; } @@ -121,17 +121,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (DataBus.VehicleInfo.VehicleSpeed.IsEqual(0)) { return InitStartGear(absTime, outTorque, outAngularVelocity); } - for (var gear = (uint)ModelData.Gears.Count; gear > 1; gear--) { + for (var gear = (uint)GearboxModelData.Gears.Count; gear > 1; gear--) { var response = _gearbox.Initialize(absTime, gear, outTorque, outAngularVelocity); - var inAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; + var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; var fullLoadPower = response.Engine.PowerRequest - response.DeltaFullLoad; var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; var inTorque = response.Clutch.PowerRequest / inAngularSpeed; // if in shift curve and torque reserve is provided: return the current gear if (!IsBelowDownShiftCurve(gear, inTorque, inAngularSpeed) && !IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && - reserve >= ModelData.StartTorqueReserve) { + reserve >= GearshiftParams.StartTorqueReserve) { if ((inAngularSpeed - DataBus.EngineInfo.EngineIdleSpeed) / (DataBus.EngineInfo.EngineRatedSpeed - DataBus.EngineInfo.EngineIdleSpeed) < Constants.SimulationSettings.ClutchClosingSpeedNorm && gear > 1) { gear--; @@ -141,7 +141,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // if over the up shift curve: return the previous gear (even thou it did not provide the required torque reserve) - if (IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && gear < ModelData.Gears.Count) { + if (IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && gear < GearboxModelData.Gears.Count) { _nextGear = gear; return gear + 1; } @@ -155,7 +155,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private uint InitStartGear(Second absTime, NewtonMeter outTorque, PerSecond outAngularVelocity) { for (var gear = MaxStartGear; gear > 1; gear--) { - var inAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; + var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; var ratedSpeed = DataBus.EngineInfo.EngineRatedSpeed; if (inAngularSpeed > ratedSpeed || inAngularSpeed.IsEqual(0)) { @@ -167,7 +167,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fullLoadPower = response.Engine.DynamicFullLoadPower; //EnginePowerRequest - response.DeltaFullLoad; var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; - if (response.Engine.EngineSpeed > DataBus.EngineInfo.EngineIdleSpeed && reserve >= ModelData.StartTorqueReserve) { + if (response.Engine.EngineSpeed > DataBus.EngineInfo.EngineIdleSpeed && reserve >= GearshiftParams.StartTorqueReserve) { _nextGear = gear; return gear; } @@ -184,15 +184,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // emergency shift to not stall the engine ------------------------ - if (gear == 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + if (gear == 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { return true; } _nextGear = gear; - while (_nextGear > 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + while (_nextGear > 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { _nextGear--; } - while (_nextGear < ModelData.Gears.Count && - SpeedTooHighForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + while (_nextGear < GearboxModelData.Gears.Count && + SpeedTooHighForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { _nextGear++; } if (_nextGear != gear) { @@ -200,7 +200,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // normal shift when all requirements are fullfilled ------------------ - var minimumShiftTimePassed = (lastShiftTime + ModelData.ShiftTime).IsSmallerOrEqual(absTime); + var minimumShiftTimePassed = (lastShiftTime + GearshiftParams.TimeBetweenGearshifts).IsSmallerOrEqual(absTime); if (!minimumShiftTimePassed) { return false; } @@ -227,7 +227,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (DataBus.DriverInfo.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverInfo.DriverBehavior != DrivingBehavior.Driving) { return currentGear; } - if ((absTime - _gearbox.LastDownshift).IsSmaller(_gearbox.ModelData.UpshiftAfterDownshiftDelay)) { + if ((absTime - _gearbox.LastDownshift).IsSmaller(GearshiftParams.UpshiftAfterDownshiftDelay)) { return currentGear; } var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, response); @@ -236,7 +236,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // estimate acceleration for selected gear - if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(_gearbox.ModelData.UpshiftMinAcceleration)) { + if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(GearshiftParams.UpshiftMinAcceleration)) { // if less than 0.1 for next gear, don't shift if (nextGear - currentGear == 1) { return currentGear; @@ -244,7 +244,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift! if (nextGear > currentGear && EstimateAccelerationForGear(currentGear + 1, outAngularVelocity) - .IsSmaller(_gearbox.ModelData.UpshiftMinAcceleration)) { + .IsSmaller(GearshiftParams.UpshiftMinAcceleration)) { return currentGear; } nextGear = currentGear + 1; @@ -255,7 +255,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected virtual uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear, IResponse response) { - if ((absTime - _gearbox.LastUpshift).IsSmaller(_gearbox.ModelData.DownshiftAfterUpshiftDelay)) { + if ((absTime - _gearbox.LastUpshift).IsSmaller(GearshiftParams.DownshiftAfterUpshiftDelay)) { return currentGear; } return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, response); @@ -267,7 +267,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (IsAboveUpShiftCurve(currentGear, inTorque, inAngularVelocity)) { currentGear++; - while (SkipGears && currentGear < ModelData.Gears.Count) { + while (SkipGears && currentGear < GearboxModelData.Gears.Count) { currentGear++; var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, currentGear); @@ -276,7 +276,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var maxTorque = VectoMath.Min(response.Engine.DynamicFullLoadPower / ((DataBus.EngineInfo.EngineSpeed + response.Engine.EngineSpeed) / 2), currentGear > 1 - ? ModelData.Gears[currentGear].ShiftPolygon.InterpolateDownshift(response.Engine.EngineSpeed) + ? GearboxModelData.Gears[currentGear].ShiftPolygon.InterpolateDownshift(response.Engine.EngineSpeed) : double.MaxValue.SI<NewtonMeter>()); var reserve = 1 - inTorque / maxTorque; @@ -290,7 +290,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // early up shift to higher gear --------------------------------------- - if (EarlyShiftUp && currentGear < ModelData.Gears.Count) { + if (EarlyShiftUp && currentGear < GearboxModelData.Gears.Count) { currentGear = CheckEarlyUpshift(absTime, dt, outTorque, outAngularVelocity, currentGear, response1); } return currentGear; @@ -302,7 +302,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var tryNextGear = currentGear + 1; var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, tryNextGear); - var inAngularVelocity = ModelData.Gears[tryNextGear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[tryNextGear].Ratio * outAngularVelocity; var inTorque = response.Clutch.PowerRequest / inAngularVelocity; // if next gear supplied enough power reserve: take it @@ -311,7 +311,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fullLoadPower = response.Engine.PowerRequest - response.DeltaFullLoad; var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; - if (reserve >= ModelData.TorqueReserve) { + if (reserve >= GearshiftParams.TorqueReserve) { currentGear = tryNextGear; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyACEA.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyACEA.cs index 5148f4415e9aab95de2f77665e37668cc0eeea64..18712ea1e7a9a70149e7f963d478b7bf931b622e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyACEA.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyACEA.cs @@ -99,7 +99,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl MaxGradability = new MaxGradabilityLookup(); dataBus.AddPreprocessor(new MaxGradabilityPreprocessor(MaxGradability, data, TestContainer)); - EngineSpeedAtDriveOff = new Dictionary<uint, PerSecond>(ModelData.Gears.Count); + EngineSpeedAtDriveOff = new Dictionary<uint, PerSecond>(GearboxModelData.Gears.Count); dataBus.AddPreprocessor(new EngineSpeedDriveOffPreprocessor(EngineSpeedAtDriveOff, data, TestContainer)); AverageAccelerationTorqueLookup = new AverageAccelerationTorqueLookup(); @@ -112,15 +112,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private bool SpeedTooLowForEngine(uint gear, PerSecond outAngularSpeed) { - return (outAngularSpeed * ModelData.Gears[gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); + return (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); } private bool SpeedTooHighForEngine(uint gear, PerSecond outAngularSpeed) { return - (outAngularSpeed * ModelData.Gears[gear].Ratio).IsGreaterOrEqual( + (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsGreaterOrEqual( VectoMath.Min( - ModelData.Gears[gear].MaxSpeed, + GearboxModelData.Gears[gear].MaxSpeed, DataBus.EngineInfo.EngineN95hSpeed)); } @@ -156,16 +156,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // emergency shift to not stall the engine ------------------------ - if (gear == 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + if (gear == 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { return true; } _nextGear = gear; - while (_nextGear > 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + while (_nextGear > 1 && SpeedTooLowForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { _nextGear--; } - while (_nextGear < ModelData.Gears.Count && - SpeedTooHighForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + while (_nextGear < GearboxModelData.Gears.Count && + SpeedTooHighForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { _nextGear++; } @@ -177,7 +177,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var currentVelocity = DataBus.VehicleInfo.VehicleSpeed; accRsv = CalcAccelerationReserve(currentVelocity, absTime + dt); - var minimumShiftTimePassed = (lastShiftTime + ModelData.ShiftTime).IsSmallerOrEqual(absTime); + var minimumShiftTimePassed = (lastShiftTime + GearshiftParams.TimeBetweenGearshifts).IsSmallerOrEqual(absTime); if (!minimumShiftTimePassed) { return false; } @@ -212,7 +212,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PerSecond inAngularVelocity, uint gear, Second lastShiftTime) { var lookAheadDistance = - DataBus.VehicleInfo.VehicleSpeed * ModelData.TractionInterruption; //ShiftStrategyParameters.GearResidenceTime; + DataBus.VehicleInfo.VehicleSpeed * GearboxModelData.TractionInterruption; //ShiftStrategyParameters.GearResidenceTime; var roadGradient = DataBus.DrivingCycleInfo.CycleLookAhead(lookAheadDistance).RoadGradient; var currentVelocity = DataBus.VehicleInfo.VehicleSpeed; @@ -225,7 +225,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } - var gearLimitHigh = Math.Min(ModelData.Gears.Count, gear + ShiftStrategyParameters.AllowedGearRangeUp); + var gearLimitHigh = Math.Min(GearboxModelData.Gears.Count, gear + ShiftStrategyParameters.AllowedGearRangeUp); GearRatings.Clear(); @@ -282,9 +282,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { var gradientBelowMaxGrad = roadGradient < MaxGradability.GradabilityLimitedTorque(nextGear); var engineSpeedAboveMin = - outAngularVelocity * ModelData.Gears[nextGear].Ratio > PowertrainConfig.EngineData.IdleSpeed; + outAngularVelocity * GearboxModelData.Gears[nextGear].Ratio > PowertrainConfig.EngineData.IdleSpeed; - var engineSpeedBelowMax = outAngularVelocity * ModelData.Gears[nextGear].Ratio < + var engineSpeedBelowMax = outAngularVelocity * GearboxModelData.Gears[nextGear].Ratio < PowertrainConfig.EngineData.FullLoadCurves[0].N95hSpeed; if (!(gradientBelowMaxGrad && engineSpeedAboveMin && engineSpeedBelowMax)) { @@ -319,12 +319,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private bool UpshiftAllowed(Second absTime) { - return (absTime - _gearbox.LastDownshift).IsGreaterOrEqual(_gearbox.ModelData.UpshiftAfterDownshiftDelay); + return (absTime - _gearbox.LastDownshift).IsGreaterOrEqual(GearshiftParams.UpshiftAfterDownshiftDelay); } private bool DownshiftAllowed(Second absTime) { - return (absTime - _gearbox.LastUpshift).IsGreaterOrEqual(_gearbox.ModelData.DownshiftAfterUpshiftDelay); + return (absTime - _gearbox.LastUpshift).IsGreaterOrEqual(GearshiftParams.DownshiftAfterUpshiftDelay); } private GearRating RatingGear( @@ -504,12 +504,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var estimatedVelocityPostShift = VelocityDropData.Interpolate(currentVelocity, gradient); var predictedVelocity = DataBus.DriverInfo.DriverBehavior == DrivingBehavior.Braking ? currentVelocity + PowertrainConfig.DriverData.AccelerationCurve.Lookup(currentVelocity).Deceleration * - ModelData.TractionInterruption + GearboxModelData.TractionInterruption : CalcPredictionVelocity(currentVelocity, estimatedVelocityPostShift); if (inAngularVelocity < GetEngineSpeedLimitLow(false)) { for (var i = Math.Max(1, gear - ShiftStrategyParameters.AllowedGearRangeDown); - i <= Math.Min(ModelData.Gears.Count, gear + ShiftStrategyParameters.AllowedGearRangeUp); + i <= Math.Min(GearboxModelData.Gears.Count, gear + ShiftStrategyParameters.AllowedGearRangeUp); i++) { var nextGear = (uint)i; TestContainerGbx.Gear = nextGear; @@ -523,7 +523,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } if (inAngularVelocity >= upperEngineSpeedLimit) { - for (var i = Math.Min(ModelData.Gears.Count, gear + ShiftStrategyParameters.AllowedGearRangeUp); + for (var i = Math.Min(GearboxModelData.Gears.Count, gear + ShiftStrategyParameters.AllowedGearRangeUp); i >= Math.Max(1, gear + ShiftStrategyParameters.AllowedGearRangeDown); i--) { var nextGear = (uint)i; @@ -586,8 +586,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return InitStartGear(torque, outAngularVelocity); } - for (var gear = (uint)ModelData.Gears.Count; gear > 1; gear--) { - var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear].Ratio; + for (var gear = (uint)GearboxModelData.Gears.Count; gear > 1; gear--) { + var inAngularVelocity = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; if (DataBus.EngineInfo.EngineSpeed < inAngularVelocity && inAngularVelocity < DataBus.EngineInfo.EngineRatedSpeed) { _nextGear = gear; return gear; @@ -599,7 +599,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private uint InitStartGear(NewtonMeter outTorque, PerSecond outAngularVelocity) { - var maxStartGear = (int)Math.Round(ModelData.Gears.Count / 2.0, MidpointRounding.AwayFromZero); + var maxStartGear = (int)Math.Round(GearboxModelData.Gears.Count / 2.0, MidpointRounding.AwayFromZero); var currentVelocity = DataBus.VehicleInfo.VehicleSpeed; var gradient = CalcGradientDuringGearshift(true, null, null); @@ -710,7 +710,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl while (_nextGear > 1 && SpeedTooLowForEngine(_nextGear, outAngularVelocity)) { _nextGear--; } - while (_nextGear < ModelData.Gears.Count && + while (_nextGear < GearboxModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { _nextGear++; } @@ -731,7 +731,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public override void WriteModalResults(IModalDataContainer container) { - foreach (var gear in ModelData.Gears.Keys) { + foreach (var gear in GearboxModelData.Gears.Keys) { container.SetDataValue( string.Format("Gear{0}-Rating", gear), GearRatings.ContainsKey(gear) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs index 974ef78a199fb9062f9120ce3ed2e36c95c5a48d..35ef0d60a4d40b3daaec8abb5f6698a8b4a04cbc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs @@ -111,8 +111,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { var tryNextGear = (uint)(currentGear + i); - if (tryNextGear > ModelData.Gears.Keys.Max() || - !(ModelData.Gears[tryNextGear].Ratio < shiftStrategyParameters.RatioEarlyUpshiftFC)) { + if (tryNextGear > GearboxModelData.Gears.Keys.Max() || + !(GearboxModelData.Gears[tryNextGear].Ratio < shiftStrategyParameters.RatioEarlyUpshiftFC)) { continue; } @@ -121,7 +121,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration, tryNextGear); var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, tryNextGear); - var inAngularVelocity = ModelData.Gears[tryNextGear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[tryNextGear].Ratio * outAngularVelocity; var inTorque = response.Clutch.PowerRequest / inAngularVelocity; // if next gear supplied enough power reserve: take it @@ -130,7 +130,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } - var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio / ModelData.Gears[currentGear].Ratio * ModelData.Gears[tryNextGear].Ratio)).Cast<PerSecond>(); + var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio / GearboxModelData.Gears[currentGear].Ratio * GearboxModelData.Gears[tryNextGear].Ratio)).Cast<PerSecond>(); if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { continue; } @@ -146,14 +146,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //var reserve = 1 - response.EngineTorqueDemandTotal / response.EngineStationaryFullLoadTorque; - if (reserve < ModelData.TorqueReserve /* && reserve > -0.1*/) { + if (reserve < GearshiftParams.TorqueReserve /* && reserve > -0.1*/) { //var acc = EstimateAcceleration(outAngularVelocity, outTorque); - var accelerationFactor = outAngularVelocity * ModelData.Gears[currentGear].Ratio < fld[0].NTq98hSpeed + var accelerationFactor = outAngularVelocity * GearboxModelData.Gears[currentGear].Ratio < fld[0].NTq98hSpeed ? 1.0 : VectoMath.Interpolate( fld[0].NTq98hSpeed, fld[0].NP98hSpeed, 1.0, shiftStrategyParameters.AccelerationFactor, - outAngularVelocity * ModelData.Gears[currentGear].Ratio); + outAngularVelocity * GearboxModelData.Gears[currentGear].Ratio); if (accelerationFactor.IsEqual(1, 1e-9)) { continue; } @@ -166,7 +166,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl response = RequestDryRunWithGear(absTime, dt, reducedTorque, outAngularVelocity, tryNextGear); fullLoadPower = response.Engine.PowerRequest - response.DeltaFullLoad; reserve = 1 - response.Engine.PowerRequest / fullLoadPower; - if (reserve < ModelData.TorqueReserve) { + if (reserve < GearshiftParams.TorqueReserve) { continue; } else { //Log.Error("foo"); @@ -186,7 +186,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl fld[tryNextGear].FullLoadStationaryTorque(response.Engine.EngineSpeed)); var fcNext = GetFCRating(response.Engine.EngineSpeed, tqNext); - if (reserve < ModelData.TorqueReserve || + if (reserve < GearshiftParams.TorqueReserve || !fcNext.IsSmaller(fcCurrent * shiftStrategyParameters.RatingFactorCurrentGear) || !fcNext.IsSmaller(minFc)) { continue; } @@ -228,7 +228,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var nextGear = base.DoCheckDownshift( absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, response); - if (nextGear == currentGear && currentGear > ModelData.Gears.Keys.Min()) { + if (nextGear == currentGear && currentGear > GearboxModelData.Gears.Keys.Min()) { nextGear = CheckEarlyDownshift(absTime, dt, outTorque, outAngularVelocity, currentGear, response); } return nextGear; @@ -252,7 +252,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { var tryNextGear = (uint)(currentGear - i); - if (tryNextGear <= 1 || !(ModelData.Gears[tryNextGear].Ratio <= shiftStrategyParameters.RatioEarlyDownshiftFC)) { + if (tryNextGear <= 1 || !(GearboxModelData.Gears[tryNextGear].Ratio <= shiftStrategyParameters.RatioEarlyDownshiftFC)) { continue; } @@ -260,7 +260,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //var response = RequestDryRunWithGear(absTime, dt, DataBus.VehicleSpeed, DataBus.DriverAcceleration, tryNextGear); - var inAngularVelocity = ModelData.Gears[tryNextGear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[tryNextGear].Ratio * outAngularVelocity; var inTorque = response.Clutch.PowerRequest / inAngularVelocity; if (IsAboveUpShiftCurve(tryNextGear, inTorque, inAngularVelocity)) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index 789865aac600bd641e28b1b0d32c56c1ec4d6ac7..e167d6f5c5fad3d6ae6f7996084495bff955a5dd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -164,7 +164,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl inTorque = outTorque / effectiveRatio + torqueLossResult.Value; } if (CurrentState.Disengaged) { - return NextComponent.Initialize(0.SI<NewtonMeter>(), null); + return NextComponent.Initialize(0.SI<NewtonMeter>(), DataBus.EngineInfo.EngineIdleSpeed); } if (!CurrentState.TorqueConverterLocked && !ModelData.Gears[Gear].HasTorqueConverter) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs index 0a10069d58a79a87ac8b53009fa01e5053d58077..d776cc78f04bcc7faeefbed83c68509a2f9fc67c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs @@ -99,7 +99,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } var torqueConverterLocked = true; - for (var gear = ModelData.Gears.Keys.Max(); gear > 1; gear--) { + for (var gear = GearboxModelData.Gears.Keys.Max(); gear > 1; gear--) { if (_gearbox.ModelData.Gears[gear].HasTorqueConverter) { torqueConverterLocked = false; } @@ -210,20 +210,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // Emergency Upshift: if higher than engine rated speed - if (inAngularVelocity.IsGreaterOrEqual(VectoMath.Min(ModelData.Gears[gear].MaxSpeed, DataBus.EngineInfo.EngineN95hSpeed))) { + if (inAngularVelocity.IsGreaterOrEqual(VectoMath.Min(GearboxModelData.Gears[gear].MaxSpeed, DataBus.EngineInfo.EngineN95hSpeed))) { // check if upshift is possible - if (!ModelData.Gears.ContainsKey(gear + 1)) { + if (!GearboxModelData.Gears.ContainsKey(gear + 1)) { return false; } PerSecond nextInAngularSpeed; NewtonMeter nextInTorque; - if (ModelData.Gears[gear].HasLockedGear) { - nextInAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; - nextInTorque = outTorque / ModelData.Gears[gear].Ratio; + if (GearboxModelData.Gears[gear].HasLockedGear) { + nextInAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; + nextInTorque = outTorque / GearboxModelData.Gears[gear].Ratio; } else { - nextInAngularSpeed = outAngularVelocity * ModelData.Gears[gear + 1].Ratio; - nextInTorque = outTorque / ModelData.Gears[gear + 1].Ratio; + nextInAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear + 1].Ratio; + nextInTorque = outTorque / GearboxModelData.Gears[gear + 1].Ratio; } var acc = EstimateAccelerationForGear(gear + 1, outAngularVelocity); if ((acc > 0 || _gearbox.TCLocked) && !IsBelowDownShiftCurve(gear + 1, nextInTorque, nextInAngularSpeed)) { @@ -241,12 +241,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime, IResponse response) { - var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(ModelData.ShiftTime); + var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(GearshiftParams.TimeBetweenGearshifts); if (!shiftTimeReached) { return false; } - var currentGear = ModelData.Gears[gear]; + var currentGear = GearboxModelData.Gears[gear]; if (_gearbox.TorqueConverterLocked || currentGear.HasLockedGear) { var result = CheckUpshiftToLocked(absTime, outAngularVelocity, inTorque, inAngularVelocity, gear); @@ -256,8 +256,8 @@ 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 && outAngularVelocity.IsGreater(0)) { + if (!_gearbox.TorqueConverterLocked && GearboxModelData.Gears.ContainsKey(gear + 1) && + GearboxModelData.Gears[gear + 1].HasTorqueConverter && outAngularVelocity.IsGreater(0)) { var result = CheckUpshiftTcTc( absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, gear, currentGear, response); if (result.HasValue) { @@ -265,7 +265,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } } - if (gear < ModelData.Gears.Keys.Max()) { + if (gear < GearboxModelData.Gears.Keys.Max()) { var earlyUpshift = CheckEarlyUpshift( absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, gear, lastShiftTime, response); if (earlyUpshift.HasValue) { @@ -288,14 +288,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl PerSecond inAngularVelocity, uint gear, GearData currentGear, IResponse response) { // C -> C+1 - var nextGear = ModelData.Gears[gear + 1]; + var nextGear = GearboxModelData.Gears[gear + 1]; var gearRatio = nextGear.TorqueConverterRatio / currentGear.TorqueConverterRatio; var minEngineSpeed = VectoMath.Min(700.RPMtoRad(), gearRatio * (DataBus.EngineInfo.EngineN80hSpeed - 150.RPMtoRad())); var nextGearboxInSpeed = outAngularVelocity * nextGear.TorqueConverterRatio; var nextGearboxInTorque = outTorque / nextGear.TorqueConverterRatio; var shiftLosses = _gearbox.ComputeShiftLosses(outTorque, outAngularVelocity, gear + 1) / - ModelData.PowershiftShiftTime / nextGearboxInSpeed; + GearboxModelData.PowershiftShiftTime / nextGearboxInSpeed; nextGearboxInTorque += shiftLosses; var tcOperatingPoint = _gearbox.TorqueConverter.FindOperatingPoint(absTime, dt, nextGearboxInTorque, nextGearboxInSpeed); @@ -312,7 +312,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl EstimateAcceleration( outAngularVelocity, outTorque, inAngularVelocity, inTorque, gear, response); // EstimateAccelerationForGear(gear + 1, outAngularVelocity); var minAcceleration = VectoMath.Min( - ModelData.TorqueConverterData.CCUpshiftMinAcceleration, + GearboxModelData.TorqueConverterData.CCUpshiftMinAcceleration, DataBus.DriverInfo.DriverAcceleration); var minAccelerationReachable = reachableAcceleration.IsGreaterOrEqual(minAcceleration); @@ -332,11 +332,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // L -> L+1 // C -> L var nextGear = _gearbox.TorqueConverterLocked ? gear + 1 : gear; - if (!ModelData.Gears.ContainsKey(nextGear)) { + if (!GearboxModelData.Gears.ContainsKey(nextGear)) { return false; } - var nextEngineSpeed = outAngularVelocity * ModelData.Gears[nextGear].Ratio; + var nextEngineSpeed = outAngularVelocity * GearboxModelData.Gears[nextGear].Ratio; if (nextEngineSpeed.IsEqual(0)) { return false; } @@ -349,8 +349,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (!DataBus.VehicleInfo.VehicleSpeed.IsEqual(0)) { var reachableAcceleration = EstimateAccelerationForGear(nextGear, outAngularVelocity); var minAcceleration = _gearbox.TorqueConverterLocked - ? ModelData.UpshiftMinAcceleration - : ModelData.TorqueConverterData.CLUpshiftMinAcceleration; + ? GearshiftParams.UpshiftMinAcceleration + : GearboxModelData.TorqueConverterData.CLUpshiftMinAcceleration; minAcceleration = VectoMath.Min( minAcceleration, VectoMath.Max(0.SI<MeterPerSquareSecond>(), DataBus.DriverInfo.DriverAcceleration)); minAccelerationReachable = reachableAcceleration.IsGreaterOrEqual(minAcceleration); @@ -377,23 +377,23 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl bool torqueConverterLocked) { var shiftPolygon = torqueConverterLocked - ? ModelData.Gears[gear].ShiftPolygon - : ModelData.Gears[gear].TorqueConverterShiftPolygon; + ? GearboxModelData.Gears[gear].ShiftPolygon + : GearboxModelData.Gears[gear].TorqueConverterShiftPolygon; - return gear < ModelData.Gears.Keys.Max() && shiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); + return gear < GearboxModelData.Gears.Keys.Max() && shiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); } protected virtual void Upshift(Second absTime, uint gear) { // C -> L: switch from torque converter to locked gear - if (!_gearbox.TorqueConverterLocked && ModelData.Gears[gear].HasLockedGear) { + if (!_gearbox.TorqueConverterLocked && GearboxModelData.Gears[gear].HasLockedGear) { _nextGear.SetState(absTime, disengaged: false, gear: gear, tcLocked: true); return; } // L -> L+1 // C -> C+1 - if (ModelData.Gears.ContainsKey(gear + 1)) { + if (GearboxModelData.Gears.ContainsKey(gear + 1)) { _nextGear.SetState(absTime, disengaged: false, gear: gear + 1, tcLocked: _gearbox.TorqueConverterLocked); return; } @@ -408,7 +408,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime, IResponse response) { - var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(ModelData.ShiftTime); + var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(GearshiftParams.TimeBetweenGearshifts); if (shiftTimeReached && IsBelowDownShiftCurve(gear, inTorque, inAngularVelocity)) { Downshift(absTime, gear); @@ -471,20 +471,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// <returns><c>true</c> if the operating point is below the down-shift curv; otherwise, <c>false</c>.</returns> protected virtual bool IsBelowDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) { - return gear > 1 && ModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); + return gear > 1 && GearboxModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); } protected virtual void Downshift(Second absTime, uint gear) { // L -> C - if (_gearbox.TorqueConverterLocked && ModelData.Gears[gear].HasTorqueConverter) { + if (_gearbox.TorqueConverterLocked && GearboxModelData.Gears[gear].HasTorqueConverter) { _nextGear.SetState(absTime, disengaged: false, gear: gear, tcLocked: false); return; } // L -> L-1 // C -> C-1 - if (ModelData.Gears.ContainsKey(gear - 1)) { + if (GearboxModelData.Gears.ContainsKey(gear - 1)) { _nextGear.SetState(absTime, disengaged: false, gear: gear - 1, tcLocked: _gearbox.TorqueConverterLocked); return; } @@ -511,9 +511,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var tcLossesCurrentGear = tcInSpeed * tcInTorque - gbxOutSpeed * gbxOutTorque; - var nextTcOutSpeed = gbxOutSpeed * ModelData.Gears[currentGear + 1].TorqueConverterRatio; + var nextTcOutSpeed = gbxOutSpeed * GearboxModelData.Gears[currentGear + 1].TorqueConverterRatio; - var tcNext = ModelData.TorqueConverterData.LookupOperatingPointOut( + var tcNext = GearboxModelData.TorqueConverterData.LookupOperatingPointOut( nextTcOutSpeed, response.Engine.EngineSpeed, response.Engine.TorqueOutDemand); var tcLossesNextGear = tcNext.InAngularVelocity * tcNext.InTorque - tcNext.OutAngularVelocity * tcNext.OutTorque; var deltaTcLosses = tcLossesNextGear - tcLossesCurrentGear; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs index a3d2a4d79d79ec4a198dbf4559e5a5bbe251b37e..ead9538acf073eed1aa77951f075b4e2d0a3c0fa 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs @@ -194,7 +194,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var shiftSpeed = UpshiftLineTCLocked.LookupShiftSpeed( _loadStage, DataBus.DrivingCycleInfo.RoadGradient, DataBus.DriverInfo.DriverAcceleration, _accMin, _accMax); - var shiftSpeedGbxOut = shiftSpeed / ModelData.Gears[currentGear].Ratio; + var shiftSpeedGbxOut = shiftSpeed / GearboxModelData.Gears[currentGear].Ratio; if (outAngularVelocity > shiftSpeedGbxOut) { Upshift(absTime, currentGear); return true; @@ -273,11 +273,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } - if (!(ModelData.Gears[next.Gear].Ratio < shiftStrategyParameters.RatioEarlyUpshiftFC)) { + if (!(GearboxModelData.Gears[next.Gear].Ratio < shiftStrategyParameters.RatioEarlyUpshiftFC)) { continue; } - var inAngularVelocity = ModelData.Gears[next.Gear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[next.Gear].Ratio * outAngularVelocity; var totalTransmissionRatio = inAngularVelocity / (DataBus.VehicleInfo.VehicleSpeed + DataBus.DriverInfo.DriverAcceleration * dt); var estimatedEngineSpeed = (vehicleSpeedPostShift * totalTransmissionRatio).Cast<PerSecond>(); if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { @@ -298,19 +298,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if next gear supplied enough power reserve: take it // otherwise take - if (ModelData.Gears[next.Gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inAngularVelocity)) { + if (GearboxModelData.Gears[next.Gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inAngularVelocity)) { continue; } var fullLoadPower = response.Engine.PowerRequest - response.DeltaFullLoad; var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; - if (reserve < ModelData.TorqueReserve) { - var accelerationFactor = outAngularVelocity * ModelData.Gears[currentGear].Ratio < fld[0].NTq98hSpeed + if (reserve < GearshiftParams.TorqueReserve) { + var accelerationFactor = outAngularVelocity * GearboxModelData.Gears[currentGear].Ratio < fld[0].NTq98hSpeed ? 1.0 : VectoMath.Interpolate( fld[0].NTq98hSpeed, fld[0].NP98hSpeed, 1.0, shiftStrategyParameters.AccelerationFactor, - outAngularVelocity * ModelData.Gears[currentGear].Ratio); + outAngularVelocity * GearboxModelData.Gears[currentGear].Ratio); if (accelerationFactor.IsEqual(1, 1e-9)) { continue; } @@ -323,7 +323,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration * accelerationFactor, next); fullLoadPower = response.Engine.PowerRequest - response.DeltaFullLoad; reserve = 1 - response.Engine.PowerRequest / fullLoadPower; - if (reserve < ModelData.TorqueReserve) { + if (reserve < GearshiftParams.TorqueReserve) { continue; } } @@ -343,7 +343,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl fld[next.Gear].FullLoadStationaryTorque(response.Engine.EngineSpeed)); var fcNext = GetFCRating(response.Engine.EngineSpeed, tqNext); - if (reserve < ModelData.TorqueReserve || + if (reserve < GearshiftParams.TorqueReserve || !fcNext.IsSmaller(fcCurrent * shiftStrategyParameters.RatingFactorCurrentGear) || !fcNext.IsSmaller(minFc)) { continue; } @@ -407,13 +407,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } - if (!(ModelData.Gears[next.Gear].Ratio < shiftStrategyParameters.RatioEarlyDownshiftFC)) { + if (!(GearboxModelData.Gears[next.Gear].Ratio < shiftStrategyParameters.RatioEarlyDownshiftFC)) { continue; } var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, next); - var inAngularVelocity = ModelData.Gears[next.Gear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[next.Gear].Ratio * outAngularVelocity; var inTorque = response.Engine.PowerRequest / inAngularVelocity; if (!IsAboveUpShiftCurve(next.Gear, inTorque, inAngularVelocity, next.TorqueConverterLocked.Value)) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs index 71f6a0af04f51edde8c37846337f555f2e4892eb..6bbf1a1de9df8690f66e737012fd00aa97b883f5 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyVoith.cs @@ -53,7 +53,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl MaxMass = data.VehicleData.MaximumVehicleMass; FullLoadCurve = data.EngineData.FullLoadCurves[0]; - dualTCTransmission = ModelData.Gears[1].HasTorqueConverter && ModelData.Gears[2].HasTorqueConverter; + dualTCTransmission = GearboxModelData.Gears[1].HasTorqueConverter && GearboxModelData.Gears[2].HasTorqueConverter; } private void InitializeShiftLines(TableData lines) @@ -195,16 +195,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override bool CheckUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime, IResponse response) { - var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(ModelData.ShiftTime); + var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(GearshiftParams.TimeBetweenGearshifts); if (!shiftTimeReached) { return false; } - var currentGear = ModelData.Gears[gear]; + var currentGear = GearboxModelData.Gears[gear]; if (dualTCTransmission && gear == 1) { // UPSHIFT - Special rule for 1C -> 2C - if (!_gearbox.TorqueConverterLocked && ModelData.Gears.ContainsKey(gear + 1) && - ModelData.Gears[gear + 1].HasTorqueConverter && outAngularVelocity.IsGreater(0)) { + if (!_gearbox.TorqueConverterLocked && GearboxModelData.Gears.ContainsKey(gear + 1) && + GearboxModelData.Gears[gear + 1].HasTorqueConverter && outAngularVelocity.IsGreater(0)) { var result = CheckUpshiftTcTc(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, gear, currentGear, response); if (result.HasValue) { return result.Value; @@ -213,7 +213,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } else { - if (gear >= ModelData.Gears.Keys.Max()) { + if (gear >= GearboxModelData.Gears.Keys.Max()) { return false; } @@ -227,7 +227,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var shiftSpeed = UpshiftLines[gearIdx].LookupShiftSpeed( _loadStage, DataBus.DrivingCycleInfo.RoadGradient, DataBus.DriverInfo.DriverAcceleration, _accMin, _accMax); - var shiftSpeedGbxOut = shiftSpeed / ModelData.Gears[nextGear].Ratio; + var shiftSpeedGbxOut = shiftSpeed / GearboxModelData.Gears[nextGear].Ratio; if (outAngularVelocity > shiftSpeedGbxOut) { Upshift(absTime, gear); return true; @@ -240,7 +240,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected override bool CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime, IResponse response) { - var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(ModelData.ShiftTime); + var shiftTimeReached = (absTime - lastShiftTime).IsGreaterOrEqual(GearshiftParams.TimeBetweenGearshifts); if (!shiftTimeReached) { return false; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs index 4dad88d3e96101bc05055deca671630c88b84b78..db8bd5d57491f88107b6db714aaca990c04157e2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs @@ -85,17 +85,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public abstract bool TCLocked { get; } - [DebuggerHidden] - public MeterPerSecond StartSpeed - { - get { return ModelData.StartSpeed; } - } - - [DebuggerHidden] - public MeterPerSquareSecond StartAcceleration - { - get { return ModelData.StartAcceleration; } - } + //[DebuggerHidden] + //public MeterPerSecond StartSpeed + //{ + // get { return ModelData.StartSpeed; } + //} + + //[DebuggerHidden] + //public MeterPerSquareSecond StartAcceleration + //{ + // get { return ModelData.StartAcceleration; } + //} public Watt GearboxLoss() { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs index 6ed4e723e4e3e0ec0d4ba252ca8a222d9c240bb1..0a4cbb92f129d2a6b7d9249b5399e5dc3b2bb88b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs @@ -36,6 +36,7 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; @@ -47,11 +48,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public abstract class BaseShiftStrategy : LoggingObject, IShiftStrategy { protected readonly IDataBus DataBus; - protected readonly GearboxData ModelData; + protected readonly GearboxData GearboxModelData; + protected readonly ShiftStrategyParameters GearshiftParams; protected BaseShiftStrategy(IVehicleContainer dataBus) { - ModelData = dataBus.RunData.GearboxData; + GearboxModelData = dataBus.RunData.GearboxData; + GearshiftParams = dataBus.RunData.GearshiftParameters; DataBus = dataBus; } @@ -90,13 +93,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected MeterPerSquareSecond EstimateAccelerationForGear(uint gear, PerSecond gbxAngularVelocityOut) { - if (gear == 0 || gear > ModelData.Gears.Count) { + if (gear == 0 || gear > GearboxModelData.Gears.Count) { throw new VectoSimulationException("EstimateAccelerationForGear: invalid gear: {0}", gear); } var vehicleSpeed = DataBus.VehicleInfo.VehicleSpeed; - var nextEngineSpeed = gbxAngularVelocityOut * ModelData.Gears[gear].Ratio; + var nextEngineSpeed = gbxAngularVelocityOut * GearboxModelData.Gears[gear].Ratio; var maxEnginePower = DataBus.EngineInfo.EngineStationaryFullPower(nextEngineSpeed); var avgSlope = @@ -105,8 +108,8 @@ 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; - var gearboxLoss = ModelData.Gears[gear].LossMap.GetTorqueLoss(gbxAngularVelocityOut, - maxEnginePower / nextEngineSpeed * ModelData.Gears[gear].Ratio).Value * nextEngineSpeed; + var gearboxLoss = GearboxModelData.Gears[gear].LossMap.GetTorqueLoss(gbxAngularVelocityOut, + maxEnginePower / nextEngineSpeed * GearboxModelData.Gears[gear].Ratio).Value * nextEngineSpeed; //DataBus.GearboxLoss(); var slopeLoss = DataBus.VehicleInfo.SlopeResistance(avgSlope) * DataBus.VehicleInfo.VehicleSpeed; var axleLoss = DataBus.AxlegearInfo.AxlegearLoss(); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index f54f00270b7d6c3c2872288fc10f93c28d7bba81..0eaf379c2ebb6c8a4af26ba5d3060bcc9c8e3878 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -58,6 +58,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl internal readonly DrivingCycleEnumerator CycleIntervalIterator; private bool _intervalProlonged; internal IdleControllerSwitcher IdleController; + + private MeterPerSquareSecond StartAcceleration; + private MeterPerSecond StartSpeed; private DrivingCycleData.DrivingCycleEntry Left { @@ -85,18 +88,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl }; CurrentState = PreviousState.Clone(); - if (container is SimplePowertrainContainer) { - return; - } - - + StartSpeed = container.RunData.GearshiftParameters.StartSpeed; + StartAcceleration = container.RunData.GearshiftParameters.StartAcceleration; } public IResponse Initialize() { if (Left.VehicleTargetSpeed.IsEqual(0)) { - var retVal = NextComponent.Initialize(DataBus.GearboxInfo.StartSpeed, - Left.RoadGradient, DataBus.GearboxInfo.StartAcceleration); + var retVal = NextComponent.Initialize(StartSpeed, + Left.RoadGradient, StartAcceleration); if (!(retVal is ResponseSuccess)) { throw new UnexpectedResponseException("DistanceBasedDrivingCycle.Initialize: Couldn't find start gear.", retVal); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs index 02b796e4f326ef7067f6fc23100fccfcc674feef..7b60210dc1861c3c764488091d002e160ab23c4b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs @@ -277,6 +277,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var avgSpeed = (PreviousState.InAngularVelocity + outAngularVelocity) / 2.0; var torqueLoss = ModelData.DragCurve.Lookup(avgSpeed); var inTorque = outTorque + torqueLoss; + if (!DataBus.EngineCtl.CombustionEngineOn && Position == PowertrainPosition.HybridP1) { + // electric motor is directly connected to the ICE, ICE is off and EM is off - do not apply drag loss + inTorque = outTorque; + } if (!dryRun) { SetState(inTorque, outAngularVelocity); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs index ea29ea2331ce10636b7fa6484f254c0fa98c70ea..a930daa71ef4efeb16db5209b7edb415a92b2e2e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs @@ -307,8 +307,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl runData.VehicleData.DynamicTyreRadius; var minEngineSpeed = (runData.EngineData.FullLoadCurves[0].RatedSpeed - runData.EngineData.IdleSpeed) * Constants.SimulationSettings.ClutchClosingSpeedNorm + runData.EngineData.IdleSpeed; - foreach (var gearData in ModelData.Gears.Reverse()) { - if (ModelData.StartSpeed * transmissionRatio * gearData.Value.Ratio <= minEngineSpeed) + foreach (var gearData in GearboxModelData.Gears.Reverse()) { + if (GearshiftParams.StartSpeed * transmissionRatio * gearData.Value.Ratio <= minEngineSpeed) continue; MaxStartGear = gearData.Key; break; @@ -343,10 +343,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return InitStartGear(absTime, outTorque, outAngularVelocity); } - for (var gear = (uint)ModelData.Gears.Count; gear > 1; gear--) { + for (var gear = (uint)GearboxModelData.Gears.Count; gear > 1; gear--) { var response = _gearbox.Initialize(absTime, gear, outTorque, outAngularVelocity); - var inAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; + var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; var fullLoadPower = response.Engine.PowerRequest - response.DeltaFullLoad; var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; var inTorque = response.Clutch.PowerRequest / inAngularSpeed; @@ -354,7 +354,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if in shift curve and torque reserve is provided: return the current gear if (!IsBelowDownShiftCurve(gear, inTorque, inAngularSpeed) && !IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && - reserve >= ModelData.StartTorqueReserve) { + reserve >= GearshiftParams.StartTorqueReserve) { if ((inAngularSpeed - DataBus.EngineInfo.EngineIdleSpeed) / (DataBus.EngineInfo.EngineRatedSpeed - DataBus.EngineInfo.EngineIdleSpeed) < Constants.SimulationSettings.ClutchClosingSpeedNorm && gear > 1) { @@ -366,7 +366,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // if over the up shift curve: return the previous gear (even thou it did not provide the required torque reserve) - if (IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && gear < ModelData.Gears.Count) { + if (IsAboveUpShiftCurve(gear, inTorque, inAngularSpeed) && gear < GearboxModelData.Gears.Count) { _nextGear = gear; return gear + 1; } @@ -384,7 +384,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } for (var gear = MaxStartGear; gear > 1; gear--) { - var inAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; + var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; var ratedSpeed = DataBus.EngineInfo.EngineRatedSpeed; if (inAngularSpeed > ratedSpeed || inAngularSpeed.IsEqual(0)) { @@ -398,7 +398,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; if (response.Engine.EngineSpeed > DataBus.EngineInfo.EngineIdleSpeed && - reserve >= ModelData.StartTorqueReserve) { + reserve >= GearshiftParams.StartTorqueReserve) { _nextGear = gear; return gear; } @@ -411,14 +411,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private bool SpeedTooLowForEngine(uint gear, PerSecond outAngularSpeed) { - return (outAngularSpeed * ModelData.Gears[gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); + return (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); } private bool SpeedTooHighForEngine(uint gear, PerSecond outAngularSpeed) { return - (outAngularSpeed * ModelData.Gears[gear].Ratio).IsGreaterOrEqual(VectoMath.Min( - ModelData.Gears[gear].MaxSpeed, + (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsGreaterOrEqual(VectoMath.Min( + GearboxModelData.Gears[gear].MaxSpeed, DataBus.EngineInfo.EngineN95hSpeed)); } @@ -429,7 +429,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl _nextGear--; } - while (_nextGear < ModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { + while (_nextGear < GearboxModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { _nextGear++; } } @@ -447,7 +447,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl gear--; } - while (gear < ModelData.Gears.Count && SpeedTooHighForEngine(gear, outAngularVelocity)) { + while (gear < GearboxModelData.Gears.Count && SpeedTooHighForEngine(gear, outAngularVelocity)) { gear++; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs index db9567d3a69ffe3aca79fdb7262b429816e0c2b5..0fb8e1003a53835e6646ea301c352817ead54df9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs @@ -22,7 +22,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public class PEVAMTShiftStrategy : LoggingObject, IShiftStrategy { protected readonly IDataBus DataBus; - protected readonly GearboxData ModelData; + protected readonly GearboxData GearboxModelData; protected Gearbox _gearbox; protected uint _nextGear; @@ -35,6 +35,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private EfficiencyMap PowerMap; private ElectricMotorFullLoadCurve FullLoadCurve; private SI TransmissionRatio; + private ShiftStrategyParameters GearshiftParams; public bool EarlyShiftUp { get; } @@ -51,7 +52,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (runData.VehicleData == null) { return; } - ModelData = dataBus.RunData.GearboxData; + GearboxModelData = dataBus.RunData.GearboxData; + GearshiftParams = dataBus.RunData.GearshiftParameters; + PowerMap = dataBus.RunData.ElectricMachinesData .FirstOrDefault(x => x.Item1 == PowertrainPosition.BatteryElectricB2)?.Item2.EfficiencyMap; FullLoadCurve = dataBus.RunData.ElectricMachinesData @@ -121,8 +124,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // emergency shift to not stall the engine ------------------------ - while (_nextGear < ModelData.Gears.Count && - SpeedTooHighForEngine(_nextGear, inAngularVelocity / ModelData.Gears[gear].Ratio)) { + while (_nextGear < GearboxModelData.Gears.Count && + SpeedTooHighForEngine(_nextGear, inAngularVelocity / GearboxModelData.Gears[gear].Ratio)) { _nextGear++; } if (_nextGear != gear) { @@ -130,7 +133,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // normal shift when all requirements are fullfilled ------------------ - var minimumShiftTimePassed = (lastShiftTime + ModelData.ShiftTime).IsSmallerOrEqual(absTime); + var minimumShiftTimePassed = (lastShiftTime + GearshiftParams.TimeBetweenGearshifts).IsSmallerOrEqual(absTime); if (!minimumShiftTimePassed) { return false; } @@ -157,7 +160,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (DataBus.DriverInfo.DriverBehavior != DrivingBehavior.Accelerating && DataBus.DriverInfo.DriverBehavior != DrivingBehavior.Driving) { return currentGear; } - if ((absTime - _gearbox.LastDownshift).IsSmaller(_gearbox.ModelData.UpshiftAfterDownshiftDelay)) { + if ((absTime - _gearbox.LastDownshift).IsSmaller(GearshiftParams.UpshiftAfterDownshiftDelay)) { return currentGear; } var nextGear = DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, response); @@ -166,7 +169,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // estimate acceleration for selected gear - if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(_gearbox.ModelData.UpshiftMinAcceleration)) { + if (EstimateAccelerationForGear(nextGear, outAngularVelocity).IsSmaller(GearshiftParams.UpshiftMinAcceleration)) { // if less than 0.1 for next gear, don't shift if (nextGear - currentGear == 1) { return currentGear; @@ -174,7 +177,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // if a gear is skipped but acceleration is less than 0.1, try for next gear. if acceleration is still below 0.1 don't shift! if (nextGear > currentGear && EstimateAccelerationForGear(currentGear + 1, outAngularVelocity) - .IsSmaller(_gearbox.ModelData.UpshiftMinAcceleration)) { + .IsSmaller(GearshiftParams.UpshiftMinAcceleration)) { return currentGear; } nextGear = currentGear + 1; @@ -189,7 +192,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (IsAboveUpShiftCurve(currentGear, inTorque, inAngularVelocity)) { currentGear++; - while (SkipGears && currentGear < ModelData.Gears.Count) { + while (SkipGears && currentGear < GearboxModelData.Gears.Count) { currentGear++; var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, currentGear); @@ -198,7 +201,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var maxTorque = VectoMath.Min(-response.ElectricMotor.MaxDriveTorque, currentGear > 1 - ? ModelData.Gears[currentGear].ShiftPolygon.InterpolateDownshift(response.Engine.EngineSpeed) + ? GearboxModelData.Gears[currentGear].ShiftPolygon.InterpolateDownshift(response.Engine.EngineSpeed) : double.MaxValue.SI<NewtonMeter>()); var reserve = 1 - inTorque / maxTorque; @@ -212,7 +215,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } // early up shift to higher gear --------------------------------------- - if (EarlyShiftUp && currentGear < ModelData.Gears.Count) { + if (EarlyShiftUp && currentGear < GearboxModelData.Gears.Count) { currentGear = CheckEarlyUpshift(absTime, dt, outTorque, outAngularVelocity, currentGear, response1); } return currentGear; @@ -246,7 +249,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl for (var i = 1; i <= shiftStrategyParameters.AllowedGearRangeFC; i++) { var tryNextGear = (uint)(currentGear + i); - if (tryNextGear > ModelData.Gears.Keys.Max() + if (tryNextGear > GearboxModelData.Gears.Keys.Max() /*|| !(ModelData.Gears[tryNextGear].Ratio < shiftStrategyParameters.RatioEarlyUpshiftFC)*/) { continue; } @@ -256,7 +259,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //var response = RequestDryRunWithGear(absTime, dt, vehicleSpeedPostShift, DataBus.DriverAcceleration, tryNextGear); var response = RequestDryRunWithGear(absTime, dt, outTorque, outAngularVelocity, tryNextGear); - var inAngularVelocity = ModelData.Gears[tryNextGear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[tryNextGear].Ratio * outAngularVelocity; var inTorque = response.ElectricMotor.PowerRequest / inAngularVelocity; // if next gear supplied enough power reserve: take it @@ -265,7 +268,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } - var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio / ModelData.Gears[currentGear].Ratio * ModelData.Gears[tryNextGear].Ratio)).Cast<PerSecond>(); + var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio / GearboxModelData.Gears[currentGear].Ratio * GearboxModelData.Gears[tryNextGear].Ratio)).Cast<PerSecond>(); if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { continue; } @@ -290,7 +293,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fcNext = GetFCRating(response); - if (reserve < ModelData.TorqueReserve || + if (reserve < GearshiftParams.TorqueReserve || !fcNext.IsSmaller(fcCurrent * shiftStrategyParameters.RatingFactorCurrentGear) || !fcNext.IsSmaller(minFc)) { continue; } @@ -315,9 +318,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { var currentGear = response.Gearbox.Gear; - var maxGenTorque = VectoMath.Min(ModelData.Gears[currentGear].MaxTorque, response.ElectricMotor.MaxRecuperationTorque); - var maxDriveTorque = ModelData.Gears[currentGear].MaxTorque != null - ? VectoMath.Max(-ModelData.Gears[currentGear].MaxTorque, response.ElectricMotor.MaxDriveTorque) + var maxGenTorque = VectoMath.Min(GearboxModelData.Gears[currentGear].MaxTorque, response.ElectricMotor.MaxRecuperationTorque); + var maxDriveTorque = GearboxModelData.Gears[currentGear].MaxTorque != null + ? VectoMath.Max(-GearboxModelData.Gears[currentGear].MaxTorque, response.ElectricMotor.MaxDriveTorque) : response.ElectricMotor.MaxDriveTorque; var tqCurrent = (response.ElectricMotor.PowerRequest / response.ElectricMotor.AngularVelocity).LimitTo(maxDriveTorque, maxGenTorque); @@ -352,13 +355,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected MeterPerSquareSecond EstimateAccelerationForGear(uint gear, PerSecond gbxAngularVelocityOut) { - if (gear == 0 || gear > ModelData.Gears.Count) { + if (gear == 0 || gear > GearboxModelData.Gears.Count) { throw new VectoSimulationException("EstimateAccelerationForGear: invalid gear: {0}", gear); } var vehicleSpeed = DataBus.VehicleInfo.VehicleSpeed; - var nextEngineSpeed = gbxAngularVelocityOut * ModelData.Gears[gear].Ratio; + var nextEngineSpeed = gbxAngularVelocityOut * GearboxModelData.Gears[gear].Ratio; var maxEnginePower = -(FullLoadCurve.FullLoadDriveTorque(nextEngineSpeed) * nextEngineSpeed); var avgSlope = @@ -367,8 +370,8 @@ 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; - var gearboxLoss = ModelData.Gears[gear].LossMap.GetTorqueLoss(gbxAngularVelocityOut, - maxEnginePower / nextEngineSpeed * ModelData.Gears[gear].Ratio).Value * nextEngineSpeed; + var gearboxLoss = GearboxModelData.Gears[gear].LossMap.GetTorqueLoss(gbxAngularVelocityOut, + maxEnginePower / nextEngineSpeed * GearboxModelData.Gears[gear].Ratio).Value * nextEngineSpeed; //DataBus.GearboxLoss(); var slopeLoss = DataBus.VehicleInfo.SlopeResistance(avgSlope) * DataBus.VehicleInfo.VehicleSpeed; var axleLoss = DataBus.AxlegearInfo.AxlegearLoss(); @@ -382,7 +385,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected virtual uint CheckDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, uint currentGear, IResponse response) { - if ((absTime - _gearbox.LastUpshift).IsSmaller(_gearbox.ModelData.DownshiftAfterUpshiftDelay)) { + if ((absTime - _gearbox.LastUpshift).IsSmaller(GearshiftParams.DownshiftAfterUpshiftDelay)) { return currentGear; } return DoCheckDownshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, response); @@ -395,7 +398,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var nextGear = BaseDoCheckDownshift( absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, response); - if (nextGear == currentGear && currentGear > ModelData.Gears.Keys.Min()) { + if (nextGear == currentGear && currentGear > GearboxModelData.Gears.Keys.Min()) { nextGear = CheckEarlyDownshift(absTime, dt, outTorque, outAngularVelocity, currentGear, response); } return nextGear; @@ -456,7 +459,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //var response = RequestDryRunWithGear(absTime, dt, DataBus.VehicleSpeed, DataBus.DriverAcceleration, tryNextGear); - var inAngularVelocity = ModelData.Gears[tryNextGear].Ratio * outAngularVelocity; + var inAngularVelocity = GearboxModelData.Gears[tryNextGear].Ratio * outAngularVelocity; var inTorque = response.ElectricMotor.PowerRequest / inAngularVelocity; if (IsAboveUpShiftCurve(tryNextGear, inTorque, inAngularVelocity)) { @@ -490,10 +493,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return InitStartGear(absTime, outTorque, outAngularVelocity); } - for (var gear = (uint)ModelData.Gears.Count; gear > 1; gear--) { + for (var gear = (uint)GearboxModelData.Gears.Count; gear > 1; gear--) { var response = _gearbox.Initialize(absTime, gear, outTorque, outAngularVelocity); - var inAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; + var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; var inTorque = response.ElectricMotor.PowerRequest / inAngularSpeed; // if in shift curve and torque reserve is provided: return the current gear @@ -511,8 +514,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { var emSpeeds = new Dictionary<uint, Tuple<PerSecond, PerSecond>>(); - for (var gear = (uint)ModelData.Gears.Count; gear >= 1; gear--) { - var inAngularSpeed = outAngularVelocity * ModelData.Gears[gear].Ratio; + for (var gear = (uint)GearboxModelData.Gears.Count; gear >= 1; gear--) { + var inAngularSpeed = outAngularVelocity * GearboxModelData.Gears[gear].Ratio; var ratedSpeed = FullLoadCurve.MaxSpeed * 0.9; if (inAngularSpeed > ratedSpeed || inAngularSpeed.IsEqual(0)) { @@ -525,10 +528,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl //.DynamicFullLoadPower; //EnginePowerRequest - response.DeltaFullLoad; var reserve = 1 - response.ElectricMotor.PowerRequest / fullLoadPower; - if (reserve >= ModelData.StartTorqueReserve) { + if (reserve >= GearshiftParams.StartTorqueReserve) { //_nextGear = gear; //return gear; - emSpeeds[gear] = Tuple.Create(response.ElectricMotor.AngularVelocity, (ModelData.StartSpeed * TransmissionRatio * ModelData.Gears[gear].Ratio).Cast<PerSecond>()); + emSpeeds[gear] = Tuple.Create(response.ElectricMotor.AngularVelocity, (GearshiftParams.StartSpeed * TransmissionRatio * GearboxModelData.Gears[gear].Ratio).Cast<PerSecond>()); } } @@ -546,7 +549,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (gear <= 1) { return false; } - return ModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); } protected bool IsAboveDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) @@ -554,21 +557,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (gear <= 1) { return true; } - return ModelData.Gears[gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); } protected bool IsAboveUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) { - if (gear >= ModelData.Gears.Count) { + if (gear >= GearboxModelData.Gears.Count) { return false; } - return ModelData.Gears[gear].ShiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); } public uint Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) { - while (_nextGear < ModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { + while (_nextGear < GearboxModelData.Gears.Count && SpeedTooHighForEngine(_nextGear, outAngularVelocity)) { _nextGear++; } @@ -579,7 +582,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl protected bool SpeedTooHighForEngine(uint gear, PerSecond outAngularSpeed) { return - (outAngularSpeed * ModelData.Gears[gear].Ratio).IsGreaterOrEqual(VectoMath.Min(ModelData.Gears[gear].MaxSpeed, + (outAngularSpeed * GearboxModelData.Gears[gear].Ratio).IsGreaterOrEqual(VectoMath.Min(GearboxModelData.Gears[gear].MaxSpeed, DataBus.ElectricMotorInfo(PowertrainPosition.BatteryElectricB2).MaxSpeed)); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs index 301bee41009d68d8656f62c07f8317e31924bba7..87a569245cf1da4cb671468b0cde78f3578e0cad 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs @@ -71,7 +71,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (gear <= 1) { return false; } - return ModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); } protected bool IsAboveDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) @@ -79,7 +79,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (gear <= 1) { return true; } - return ModelData.Gears[gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); } @@ -92,18 +92,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// <returns><c>true</c> if the operating point is above the up-shift curve; otherwise, <c>false</c>.</returns> protected bool IsAboveUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) { - if (gear >= ModelData.Gears.Count) { + if (gear >= GearboxModelData.Gears.Count) { return false; } - return ModelData.Gears[gear].ShiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); } protected bool IsBelowUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) { - if (gear >= ModelData.Gears.Count) { + if (gear >= GearboxModelData.Gears.Count) { return true; } - return ModelData.Gears[gear].ShiftPolygon.IsBelowUpshiftCurve(inTorque, inEngineSpeed); + return GearboxModelData.Gears[gear].ShiftPolygon.IsBelowUpshiftCurve(inTorque, inEngineSpeed); } } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs index 7df738352852af74382d41ee5dd95ad7965662ea..e89213bff0bd4ca2023309175c9af43903e45268 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/VTPCycle.cs @@ -172,15 +172,15 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var transmissionRatio = RunData.AxleGearData.AxleGear.Ratio * (RunData.AngledriveData == null ? 1.0 : RunData.AngledriveData.Angledrive.Ratio) / RunData.VehicleData.DynamicTyreRadius; - var cardanStartSpeed = (RunData.GearboxData.StartSpeed * transmissionRatio).Cast<PerSecond>(); + var cardanStartSpeed = (RunData.GearshiftParameters.StartSpeed * transmissionRatio).Cast<PerSecond>(); var minEngineSpeed = (RunData.EngineData.FullLoadCurves[0].RatedSpeed - RunData.EngineData.IdleSpeed) * Constants.SimulationSettings.ClutchClosingSpeedNorm + RunData.EngineData.IdleSpeed; var wheelStartTorque = (RunData.VehicleData.VehicleCategory == VehicleCategory.Tractor ? 40000.SI<Kilogram>() - : RunData.VehicleData.GrossVehicleMass) * RunData.GearboxData.StartAcceleration * + : RunData.VehicleData.GrossVehicleMass) * RunData.GearshiftParameters.StartAcceleration * RunData.VehicleData.DynamicTyreRadius; - var wheelStartSpeed = RunData.GearboxData.StartSpeed / RunData.VehicleData.DynamicTyreRadius; + var wheelStartSpeed = RunData.GearshiftParameters.StartSpeed / RunData.VehicleData.DynamicTyreRadius; CycleIterator.LeftSample.WheelAngularVelocity = wheelStartSpeed; var maxStartGear = 1u; foreach (var gearData in RunData.GearboxData.Gears.Reverse()) @@ -200,7 +200,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var fullLoadPower = response.Engine.DynamicFullLoadPower; //EnginePowerRequest - response.DeltaFullLoad; var reserve = 1 - response.Engine.PowerRequest / fullLoadPower; - if (response.Engine.EngineSpeed > DataBus.EngineInfo.EngineIdleSpeed && reserve >= RunData.GearboxData.StartTorqueReserve) { + if (response.Engine.EngineSpeed > DataBus.EngineInfo.EngineIdleSpeed && reserve >= RunData.GearshiftParameters.StartTorqueReserve) { StartGear = gear; return; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index aab9364b20f19f6505cc59edfb372ddfba49932c..b885fb25023720f4f4e2dbf9ff4dc05dc439cf76 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -137,8 +137,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } + // ===================================================== + + public class HybridStrategyAT : AbstractHybridStrategy<ATGearbox> { + + + public HybridStrategyAT(VectoRunData runData, IVehicleContainer vehicleContainer) : base(runData, vehicleContainer) { @@ -148,10 +154,97 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies protected override ResponseDryRun RequestDryRun(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, uint nextGear, HybridStrategyResponse cfg) { - throw new NotImplementedException(); + TestPowertrain.Gearbox.Gear = PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear.Gear; + TestPowertrain.Gearbox.Disengaged = nextGear == 0; + TestPowertrain.Gearbox.DisengageGearbox = nextGear == 0; + TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + TestPowertrain.HybridController.ApplyStrategySettings(cfg); + TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); + TestPowertrain.Clutch.Initialize(DataBus.ClutchInfo.ClutchLosses); + TestPowertrain.Battery?.Initialize(DataBus.BatteryInfo.StateOfCharge); + TestPowertrain.SuperCap?.Initialize(DataBus.BatteryInfo.StateOfCharge); + + var currentGear = PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear.Gear; + + if (nextGear != 0 && nextGear != currentGear) { + if (!AllowEmergencyShift && ModelData.GearboxData.Gears[nextGear].Ratio > ModelData.GearshiftParameters.RatioEarlyUpshiftFC) { + return null; + } + + if (!AllowEmergencyShift && ModelData.GearboxData.Gears[nextGear].Ratio >= ModelData.GearshiftParameters.RatioEarlyDownshiftFC) { + return null; + } + + var estimatedVelocityPostShift = VelocityDropData.Interpolate(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + if (!AllowEmergencyShift && !estimatedVelocityPostShift.IsGreater(DeclarationData.GearboxTCU.MIN_SPEED_AFTER_TRACTION_INTERRUPTION)) { + return null; + } + + + var vDrop = DataBus.VehicleInfo.VehicleSpeed - estimatedVelocityPostShift; + var vehicleSpeedPostShift = estimatedVelocityPostShift; // DataBus.VehicleInfo.VehicleSpeed - vDrop * ModelData.GearshiftParameters.VelocityDropFactor; + TestPowertrain.Gearbox.Gear = nextGear; + var init = TestPowertrain.Container.VehiclePort.Initialize( + vehicleSpeedPostShift, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + if (!AllowEmergencyShift && init.Engine.EngineSpeed.IsSmaller(ModelData.EngineData.IdleSpeed)) { + return null; + } + } + + if (nextGear == 0) { + TestPowertrain.Gearbox._nextGear = Controller.ShiftStrategy.NextGear; + TestPowertrain.Gearbox.Disengaged = nextGear == 0; + } + + //if (!PreviousState.GearboxEngaged) { + TestPowertrain.CombustionEngine.Initialize( + (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorque, + (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineSpeed); + TestPowertrain.CombustionEngine.PreviousState.EngineOn = //true; + (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineOn; + TestPowertrain.CombustionEngine.PreviousState.EnginePower = + (DataBus.EngineInfo as CombustionEngine).PreviousState.EnginePower; + TestPowertrain.CombustionEngine.PreviousState.dt = (DataBus.EngineInfo as CombustionEngine).PreviousState.dt; + TestPowertrain.CombustionEngine.PreviousState.EngineSpeed = + (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineSpeed; + TestPowertrain.CombustionEngine.PreviousState.EngineTorque = + (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorque; + TestPowertrain.CombustionEngine.PreviousState.EngineTorqueOut = + (DataBus.EngineInfo as CombustionEngine).PreviousState.EngineTorqueOut; + TestPowertrain.CombustionEngine.PreviousState.DynamicFullLoadTorque = + (DataBus.EngineInfo as CombustionEngine).PreviousState.DynamicFullLoadTorque; + + TestPowertrain.Gearbox.PreviousState.InAngularVelocity = + (DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity; + + TestPowertrain.Clutch.PreviousState.InAngularVelocity = + (DataBus.ClutchInfo as SwitchableClutch).PreviousState.InAngularVelocity; + + //} + + var pos = ModelData.ElectricMachinesData.FirstOrDefault().Item1; + TestPowertrain.ElectricMotor.ThermalBuffer = + (DataBus.ElectricMotorInfo(pos) as ElectricMotor).ThermalBuffer; + TestPowertrain.ElectricMotor.DeRatingActive = + (DataBus.ElectricMotorInfo(pos) as ElectricMotor).DeRatingActive; + + if (/*nextGear != DataBus.GearboxInfo.Gear && */TestPowertrain.ElectricMotorP2 != null) { + TestPowertrain.ElectricMotorP2.PreviousState.OutAngularVelocity = + DataBus.ElectricMotorInfo(PowertrainPosition.HybridP2).ElectricMotorSpeed; + } + if (/*nextGear != DataBus.GearboxInfo.Gear && */TestPowertrain.ElectricMotorP3 != null) { + TestPowertrain.ElectricMotorP3.PreviousState.OutAngularVelocity = + DataBus.ElectricMotorInfo(PowertrainPosition.HybridP3).ElectricMotorSpeed; + } + + var retVal = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, true); + + return retVal as ResponseDryRun; } } + // ===================================================== + public abstract class AbstractHybridStrategy<T> : LoggingObject, IHybridControlStrategy where T: class, IHybridControlledGearbox { @@ -208,6 +301,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies protected DryRunSolutionState DryRunSolution; + protected readonly List<GearshiftPosition> GearList = new List<GearshiftPosition>(); + public AbstractHybridStrategy(VectoRunData runData, IVehicleContainer vehicleContainer) { DataBus = vehicleContainer; @@ -220,6 +315,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies throw new VectoException("Model parameters for hybrid strategy required!"); } + InitializeGearList(runData); + ElectricMotorsOff = ModelData.ElectricMachinesData .Select(x => new KeyValuePair<PowertrainPosition, NewtonMeter>(x.Item1, null)) .ToDictionary(x => x.Key, x => new Tuple<PerSecond, NewtonMeter>(null, x.Value)); @@ -268,7 +365,23 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies AllowEmergencyShift = false; } - + private void InitializeGearList(VectoRunData runData) + { + GearList.Clear(); + foreach (var gear in runData.GearboxData.Gears) { + if (runData.GearboxData.Type.AutomaticTransmission()) { + if (gear.Value.HasTorqueConverter) { + GearList.Add(new GearshiftPosition(gear.Key, false)); + } + if (gear.Value.HasLockedGear) { + GearList.Add(new GearshiftPosition(gear.Key, true)); + } + } else { + GearList.Add(new GearshiftPosition(gear.Key)); + } + } + } + public virtual IHybridController Controller { protected get; set; } public PerSecond MinICESpeed @@ -528,7 +641,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (tmp.CombustionEngineOn) { var firstEntry = new HybridResultEntry(); CalcualteCosts(firstResponse, dt, firstEntry, AllowICEOff(absTime), dryRun); - var minimumShiftTimePassed = (DataBus.GearboxInfo.LastShift + ModelData.GearboxData.ShiftTime).IsSmallerOrEqual(absTime); + var minimumShiftTimePassed = (DataBus.GearboxInfo.LastShift + ModelData.GearshiftParameters.TimeBetweenGearshifts).IsSmallerOrEqual(absTime); if (DataBus.GearboxInfo.GearEngaged(absTime) && !vehiclespeedBelowThreshold) { if ((minimumShiftTimePassed && firstEntry.IgnoreReason.EngineSpeedBelowDownshift()) || firstEntry.IgnoreReason.EngineSpeedTooLow()) { @@ -773,7 +886,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies { HybridResultEntry best = null; - if (DataBus.VehicleInfo.VehicleSpeed.IsSmallerOrEqual(ModelData.GearboxData.StartSpeed)) { + if (DataBus.VehicleInfo.VehicleSpeed.IsSmallerOrEqual(ModelData.GearshiftParameters.StartSpeed)) { best = eval.Where(x => !double.IsNaN(x.Score)).Where(x => !x.IgnoreReason.EngineSpeedTooHigh()) .OrderBy(x => x.Score).FirstOrDefault(); } else { @@ -969,7 +1082,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies // ICE is off, selected solution has a too low or too high engine speed - keep ICE off retVal.CombustionEngineOn = false; } - if (best.IgnoreReason.EngineSpeedTooLow() && !DataBus.EngineInfo.EngineOn && DataBus.VehicleInfo.VehicleSpeed.IsGreater(ModelData.GearboxData.StartSpeed)) { + if (best.IgnoreReason.EngineSpeedTooLow() && !DataBus.EngineInfo.EngineOn && DataBus.VehicleInfo.VehicleSpeed.IsGreater(ModelData.GearshiftParameters.StartSpeed)) { // ICE is off, selected solution has a too low or too high engine speed - keep ICE off retVal.CombustionEngineOn = false; } @@ -1002,20 +1115,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var emPos = ModelData.ElectricMachinesData.First().Item1; var responses = new List<HybridResultEntry>(); - var minimumShiftTimePassed = (DataBus.GearboxInfo.LastShift + ModelData.GearboxData.ShiftTime).IsSmallerOrEqual(absTime); + var minimumShiftTimePassed = (DataBus.GearboxInfo.LastShift + ModelData.GearshiftParameters.TimeBetweenGearshifts).IsSmallerOrEqual(absTime); var gearRangeUpshift = ModelData.GearshiftParameters.AllowedGearRangeUp; var gearRangeDownshift = ModelData.GearshiftParameters.AllowedGearRangeDown; if (!AllowEmergencyShift) { if (dryRun || !minimumShiftTimePassed || (absTime - DataBus.GearboxInfo.LastUpshift).IsSmaller( - ModelData.GearboxData.DownshiftAfterUpshiftDelay /*, 0.1*/) + ModelData.GearshiftParameters.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 /*,0.1*/) + ModelData.GearshiftParameters.UpshiftAfterDownshiftDelay /*,0.1*/) || (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && DataBus.VehicleInfo.VehicleSpeed.IsSmaller(5.KMPHtoMeterPerSecond()))) { gearRangeUpshift = 0; diff --git a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs index 887c3ed8685fe8c1b202d67bd9e52f0211487b05..0fdac5ed6609f4d7e1b62ba5c96a1eac428757b0 100644 --- a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs @@ -97,6 +97,7 @@ namespace TUGraz.VectoCore.Tests.Integration VehicleData = vehicleData, AirdragData = airdragData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), EngineData = engineData, ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>(), DriverData = driverData, @@ -162,9 +163,22 @@ namespace TUGraz.VectoCore.Tests.Integration TorqueConverterShiftPolygon = i == 0 ? ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) : null })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 1.SI<Second>(), + Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 0.SI<Second>(), + + PowershiftShiftTime = 0.8.SI<Second>(), + TorqueConverterData = + TorqueConverterDataReader.ReadFromFile(torqueConverterFile, 1000.RPMtoRad(), + MaxTcSpeed, ExecutionMode.Engineering, gbxType == GearboxType.ATSerial ? 1 : 1 / ratios[0], + DeclarationData.Gearbox.UpshiftMinAcceleration, DeclarationData.Gearbox.UpshiftMinAcceleration) + }; + } + + public static ShiftStrategyParameters CreateGearshiftData() + { + return new ShiftStrategyParameters() { + TimeBetweenGearshifts = 1.SI<Second>(), StartSpeed = 2.SI<MeterPerSecond>(), StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), StartTorqueReserve = 0.2, @@ -172,11 +186,6 @@ namespace TUGraz.VectoCore.Tests.Integration DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, - PowershiftShiftTime = 0.8.SI<Second>(), - TorqueConverterData = - TorqueConverterDataReader.ReadFromFile(torqueConverterFile, 1000.RPMtoRad(), - MaxTcSpeed, ExecutionMode.Engineering, gbxType == GearboxType.ATSerial ? 1 : 1 / ratios[0], - DeclarationData.Gearbox.UpshiftMinAcceleration, DeclarationData.Gearbox.UpshiftMinAcceleration) }; } diff --git a/VectoCore/VectoCoreTest/Integration/BatteryElectric/BatteryElectricTest.cs b/VectoCore/VectoCoreTest/Integration/BatteryElectric/BatteryElectricTest.cs index 5bae324576b79fb0d3017a530029606bd3523f87..45c850af15ea93c2e289cff64c1eabb61903a6ed 100644 --- a/VectoCore/VectoCoreTest/Integration/BatteryElectric/BatteryElectricTest.cs +++ b/VectoCore/VectoCoreTest/Integration/BatteryElectric/BatteryElectricTest.cs @@ -750,16 +750,10 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric Ratio = ratio, //ShiftPolygon = shiftStrategy.ComputeDeclarationShiftPolygon(GearboxType.AMT, i, null, ) })).ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), + Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), - TorqueReserve = 0.2, - StartTorqueReserve = 0.2, - DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, - UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, - UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, - StartSpeed = 2.SI<MeterPerSecond>(), - StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), + }; } @@ -843,6 +837,15 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric public static ShiftStrategyParameters CreateGearshiftData(GearboxData gbx, double axleRatio/*, PerSecond engineIdlingSpeed*/) { var retVal = new ShiftStrategyParameters { + TorqueReserve = 0.2, + StartTorqueReserve = 0.2, + DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, + UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, + UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, + StartSpeed = 2.SI<MeterPerSecond>(), + //StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), + TimeBetweenGearshifts = 2.SI<Second>(), + StartVelocity = DeclarationData.GearboxTCU.StartSpeed, StartAcceleration = DeclarationData.GearboxTCU.StartAcceleration, GearResidenceTime = DeclarationData.GearboxTCU.GearResidenceTime, diff --git a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs index 845891a36e627c640f2e27aa23b6533fd7b2d584..81981bfb8a000b1ac10902c0570c773ea7787a2d 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs @@ -90,6 +90,7 @@ namespace TUGraz.VectoCore.Tests.Integration VehicleData = vehicleData, AirdragData = airdragData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), EngineData = engineData, ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>(), SimulationType = SimulationType.DistanceCycle, @@ -140,9 +141,16 @@ namespace TUGraz.VectoCore.Tests.Integration ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), + Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), + }; + } + + private static ShiftStrategyParameters CreateGearshiftData() + { + return new ShiftStrategyParameters() { + TimeBetweenGearshifts = 2.SI<Second>(), StartSpeed = 2.SI<MeterPerSecond>(), StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), StartTorqueReserve = 0.2, diff --git a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs index b643bfe7c1dc54fb442ca8e41400244b6b4e2922..c9656b3f12850611c3aaf8978d16252c6a173a4d 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -92,6 +92,7 @@ namespace TUGraz.VectoCore.Tests.Integration VehicleData = vehicleData, AxleGearData = axleGearData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), EngineData = engineData, ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>(), DriverData = driverData, @@ -145,9 +146,15 @@ namespace TUGraz.VectoCore.Tests.Integration ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), + }; + } + + private static ShiftStrategyParameters CreateGearshiftData() + { + return new ShiftStrategyParameters() { + TimeBetweenGearshifts = 2.SI<Second>(), StartSpeed = 2.SI<MeterPerSecond>(), StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), StartTorqueReserve = 0.2, @@ -155,8 +162,9 @@ namespace TUGraz.VectoCore.Tests.Integration DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration + }; - } + } private static AxleGearData CreateAxleGearData() { diff --git a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs index 23f3e5ad48918e905d1f44bb794e6db253e61202..00c10f9ad55631c3a3b075481654b6889f39b135 100644 --- a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs @@ -1155,8 +1155,17 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid public static ShiftStrategyParameters CreateGearshiftData(GearboxData gbx, double axleRatio, PerSecond engineIdlingSpeed) { var retVal = new ShiftStrategyParameters { + TimeBetweenGearshifts = 2.SI<Second>(), + TorqueReserve = 0.2, + StartTorqueReserve = 0.2, + DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, + UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, + UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, + StartSpeed = 2.SI<MeterPerSecond>(), + StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), + StartVelocity = DeclarationData.GearboxTCU.StartSpeed, - StartAcceleration = DeclarationData.GearboxTCU.StartAcceleration, + //StartAcceleration = DeclarationData.GearboxTCU.StartAcceleration, GearResidenceTime = DeclarationData.GearboxTCU.GearResidenceTime, DnT99L_highMin1 = DeclarationData.GearboxTCU.DnT99L_highMin1, DnT99L_highMin2 = DeclarationData.GearboxTCU.DnT99L_highMin2, @@ -1227,19 +1236,12 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid Ratio = ratio, //ShiftPolygon = DeclarationData.Gearbox.ComputeEfficiencyShiftPolygon(i,) })).ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), - TorqueReserve = 0.2, - StartTorqueReserve = 0.2, - DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, - UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, - UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, - StartSpeed = 2.SI<MeterPerSecond>(), - StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), }; } + private static AxleGearData CreateAxleGearData() { var ratio = 2.59; diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index 37c46c0aa80e9665ad9e43d3741c4adbaea275b6..427fcb7a767fb099633fa3dd9e15d665b7aa8ca6 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -91,6 +91,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns EngineData = engineData, AxleGearData = axleGearData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), VehicleData = vehicleData, AirdragData = airDragData, SimulationType = SimulationType.DistanceCycle, @@ -161,6 +162,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns VehicleData = vehicleData, AxleGearData = axleGearData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), AirdragData = airDragData, SimulationType = SimulationType.DistanceCycle, ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>() @@ -244,6 +246,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns VehicleData = vehicleData, AxleGearData = axleGearData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), AirdragData = airDragData, ElectricMachinesData = new List<Tuple<PowertrainPosition, ElectricMotorData>>() }; @@ -346,9 +349,15 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), + }; + } + + private static ShiftStrategyParameters CreateGearshiftData() + { + return new ShiftStrategyParameters() { + TimeBetweenGearshifts = 2.SI<Second>(), StartSpeed = 2.SI<MeterPerSecond>(), StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), StartTorqueReserve = 0.2, @@ -356,6 +365,7 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration + }; } @@ -385,14 +395,6 @@ namespace TUGraz.VectoCore.Tests.Integration.SimulationRuns }, Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 0.SI<Second>(), - ShiftTime = 2.SI<Second>(), - StartSpeed = 2.SI<MeterPerSecond>(), - StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), - StartTorqueReserve = 0.2, - TorqueReserve = 0.2, - DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, - UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, - UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration }; } diff --git a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs index 2a3216682cfe5027a5470c0570c3152c6b8f392b..68f66e3eeeec09830fe6d5f8ff15165c61f65ac1 100644 --- a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -101,6 +101,7 @@ namespace TUGraz.VectoCore.Tests.Integration AirdragData = airdragData, AxleGearData = axleGearData, GearboxData = gearboxData, + GearshiftParameters = CreateGearshiftData(), DriverData = driverData, SimulationType = SimulationType.DistanceCycle, Cycle = cycleData @@ -160,9 +161,15 @@ namespace TUGraz.VectoCore.Tests.Integration Ratio = ratio, ShiftPolygon = ShiftPolygonReader.ReadFromFile(ShiftPolygonFile) })).ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), + }; + } + + private static ShiftStrategyParameters CreateGearshiftData() + { + return new ShiftStrategyParameters() { + TimeBetweenGearshifts = 2.SI<Second>(), StartAcceleration = 0.6.SI<MeterPerSquareSecond>(), StartSpeed = 2.SI<MeterPerSecond>(), TorqueReserve = 0.2, @@ -170,6 +177,7 @@ namespace TUGraz.VectoCore.Tests.Integration DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration + }; } diff --git a/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs index ff2708d86e3f12f2bbe0a6699a4d0d6c9521ce28..2ac28211d1fb3f9b09608bed73cadd12b79b4de6 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs @@ -345,6 +345,8 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation { 2, new GearData { Ratio = 3.806 } }, { 3, new GearData { Ratio = 2.289 } } }, + }, + GearshiftParameters = new ShiftStrategyParameters() { StartSpeed = 2.SI<MeterPerSecond>() }, Retarder = new RetarderData(), diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs index ee4858b4683d699b0fb92159ddd406b4700859ca..14c5f4dcd507d4a36b06b59c8164ed8816bf1677 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs @@ -219,6 +219,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent container.EngineInfo = engine; var runData = new VectoRunData() { GearboxData = gearboxData, + GearshiftParameters = ATPowerTrain.CreateGearshiftData(), EngineData = new CombustionEngineData() { Inertia = 5.SI<KilogramSquareMeter>() } }; container.RunData = runData; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs index 85f6244f24b3c56d1b1501dd5cb0a6eb4c315e36..67fdc9b46bc5d8996251aa652e21956c8c074a3c 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs @@ -102,13 +102,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent ShiftPolygon = ShiftPolygonReader.ReadFromFile(GearboxShiftPolygonFile) })) .ToDictionary(k => k.Item1 + 1, v => v.Item2), - ShiftTime = 2.SI<Second>(), + //ShiftTime = 2.SI<Second>(), Inertia = 0.SI<KilogramSquareMeter>(), TractionInterruption = 1.SI<Second>(), - DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, - UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, - UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, - StartSpeed = 2.SI<MeterPerSecond>() + //DownshiftAfterUpshiftDelay = DeclarationData.Gearbox.DownshiftAfterUpshiftDelay, + //UpshiftAfterDownshiftDelay = DeclarationData.Gearbox.UpshiftAfterDownshiftDelay, + //UpshiftMinAcceleration = DeclarationData.Gearbox.UpshiftMinAcceleration, + //StartSpeed = 2.SI<MeterPerSecond>() }; }