diff --git a/VECTO.sln.DotSettings b/VECTO.sln.DotSettings index a412c8c5b5ce4a4393ac6fa458871934508c8dce..9d51f473ea7b9fb26d2a50dcc36c140123a54a92 100644 --- a/VECTO.sln.DotSettings +++ b/VECTO.sln.DotSettings @@ -116,6 +116,7 @@ <s:Boolean x:Key="/Default/UserDictionary/Words/=Airdrag/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Angledrive/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=apac/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=APTN/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Axlegear/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=fullyelectric/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Graz/@EntryIndexedValue">True</s:Boolean> @@ -134,5 +135,7 @@ <s:Boolean x:Key="/Default/UserDictionary/Words/=VAUX/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=vdri/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Vecto/@EntryIndexedValue">True</s:Boolean> - <s:Boolean x:Key="/Default/UserDictionary/Words/=visco/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> + <s:Boolean x:Key="/Default/UserDictionary/Words/=visco/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=vmod/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=vsum/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> \ No newline at end of file diff --git a/VECTO/GUI/GearboxForm.Designer.vb b/VECTO/GUI/GearboxForm.Designer.vb index 5dff87bd762f4f2009152dc1999c33932e80c56e..d6f346b88aa1e6949a43a06408f52a31b9d2f1e2 100644 --- a/VECTO/GUI/GearboxForm.Designer.vb +++ b/VECTO/GUI/GearboxForm.Designer.vb @@ -918,7 +918,7 @@ Partial Class GearboxForm Me.CbGStype.FormattingEnabled = true Me.CbGStype.Location = New System.Drawing.Point(119, 102) Me.CbGStype.Name = "CbGStype" - Me.CbGStype.Size = New System.Drawing.Size(227, 21) + Me.CbGStype.Size = New System.Drawing.Size(334, 21) Me.CbGStype.TabIndex = 1 ' 'BtAddGear diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index 68dc635f4918f2289257a9aa54c00b7997ac8b1f..6487ad887232387c4ed43395e62d67b6ef951921 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -83,7 +83,7 @@ Public Class GearboxForm If (Cfg.DeclMode) Then CbGStype.DataSource = [Enum].GetValues(GetType(GearboxType)) _ .Cast(Of GearboxType)() _ - .Where(Function(type) type.ManualTransmission() OrElse type = GearboxType.ATSerial) _ + .Where(Function(type) Not type = GearboxType.APTN And (type.ManualTransmission() OrElse type = GearboxType.ATSerial)) _ .Select(Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() Else CbGStype.DataSource = [Enum].GetValues(GetType(GearboxType)) _ diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb index e320cf5692035089f8a2c3955ae9c02c707ada29..7337862543bbe80c2ddde572e9c9fe56898f0169 100644 --- a/VECTO/Input Files/VectoJob.vb +++ b/VECTO/Input Files/VectoJob.vb @@ -566,7 +566,7 @@ Public Class VectoJob End If - result = jobData.Validate(If(Cfg.DeclMode, ExecutionMode.Declaration, ExecutionMode.Engineering), vehicleInputData.VehicleType, vehicleInputData.Components.ElectricMachines?.Entries.FirstOrDefault()?.Position, If(jobData.GearboxData?.Type, GearboxType.NoGeabox), False) + result = jobData.Validate(If(Cfg.DeclMode, ExecutionMode.Declaration, ExecutionMode.Engineering), vehicleInputData.VehicleType, vehicleInputData.Components.ElectricMachines?.Entries.FirstOrDefault()?.Position, If(jobData.GearboxData?.Type, GearboxType.NoGearbox), False) If result.Any() Then Return _ New ValidationResult("Vecto Job Configuration is invalid. ", result.Select(Function(r) r.ErrorMessage).ToList()) diff --git a/VectoCommon/VectoCommon/Models/GearboxType.cs b/VectoCommon/VectoCommon/Models/GearboxType.cs index 753c5b89187216f39f4bb227ff6366848df01c19..3e3e0383a439c46e2012046afe7214ae25b31328 100644 --- a/VectoCommon/VectoCommon/Models/GearboxType.cs +++ b/VectoCommon/VectoCommon/Models/GearboxType.cs @@ -31,21 +31,19 @@ using System; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCommon.Models { - [SuppressMessage("ReSharper", "InconsistentNaming")] public enum GearboxType { MT, // Manual Transmission AMT, // Automated Manual Transmission ATSerial, // Automatic Transmission ATPowerSplit, - //Custom, + APTN, // Automatic Power Transmission - No Torque Converter DrivingCycle, - NoGeabox + NoGearbox } public static class GearBoxTypeHelper @@ -53,68 +51,46 @@ namespace TUGraz.VectoCommon.Models public static string GetLabel(this GearboxType type) { switch (type) { - case GearboxType.MT: - return "Manual Transmission (MT)"; - case GearboxType.AMT: - return "Automated Transmission (AMT)"; - case GearboxType.ATSerial: - return "Automatic Transmission - Serial (AT-S)"; - case GearboxType.ATPowerSplit: - return "Automatic Transmission - PowerSplit (AT-P)"; - case GearboxType.DrivingCycle: - return "Gear from Driving Cycle"; - default: - throw new ArgumentOutOfRangeException("GearboxType", type, null); + case GearboxType.MT: return "Manual Transmission (MT)"; + case GearboxType.AMT: return "Automated Transmission (AMT)"; + case GearboxType.ATSerial: return "Automatic Transmission - Serial (AT-S)"; //todo mk20211210 shouldn't we call it APT-S? + case GearboxType.ATPowerSplit: return "Automatic Transmission - PowerSplit (AT-P)";//todo mk20211210 shouldn't we call it APT-P? + case GearboxType.APTN: return "Automatic Transmission - No Torque Converter (APT-N)"; + case GearboxType.DrivingCycle: return "Gear from Driving Cycle"; + default: throw new ArgumentOutOfRangeException("GearboxType", type, null); } } [DebuggerStepThrough] - public static string ShortName(this GearboxType type) - { - return type.ToString(); - } + public static string ShortName(this GearboxType type) => type.ToString(); [DebuggerStepThrough] - public static bool AutomaticTransmission(this GearboxType type) - { - return type == GearboxType.ATPowerSplit || type == GearboxType.ATSerial; - } + public static bool AutomaticTransmission(this GearboxType type) => + type == GearboxType.ATPowerSplit || type == GearboxType.ATSerial; [DebuggerStepThrough] - public static bool ManualTransmission(this GearboxType type) - { - return type == GearboxType.MT || type == GearboxType.AMT; - } + public static bool ManualTransmission(this GearboxType type) => + type == GearboxType.MT || type == GearboxType.AMT || type == GearboxType.APTN; public static Second TractionInterruption(this GearboxType type) { switch (type) { - case GearboxType.MT: - return 2.SI<Second>(); - case GearboxType.AMT: - return 1.SI<Second>(); - case GearboxType.ATSerial: - case GearboxType.ATPowerSplit: - return 0.0.SI<Second>(); + case GearboxType.MT: return 2.SI<Second>(); + case GearboxType.AMT: return 1.SI<Second>(); + default: return 0.SI<Second>(); } - return 0.SI<Second>(); } public static string ToXMLFormat(this GearboxType type) { switch (type) { - case GearboxType.MT: - return "SMT"; - case GearboxType.AMT: - return "AMT"; - case GearboxType.DrivingCycle: - return type.ToString(); - case GearboxType.ATSerial: - return "APT-S"; - case GearboxType.ATPowerSplit: - return "APT-P"; - default: - throw new ArgumentOutOfRangeException("GearboxType", type, null); + case GearboxType.MT: return "SMT"; + case GearboxType.AMT: return "AMT"; + case GearboxType.DrivingCycle: return "DrivingCycle"; + case GearboxType.ATSerial: return "APT-S"; + case GearboxType.ATPowerSplit: return "APT-P"; + case GearboxType.APTN: return "APT-N"; + default: throw new ArgumentOutOfRangeException("GearboxType", type, null); } } } diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 8ddc744b62734e4fe7adc67ef7065b24e1708f25..7282f95f8215648c8f28855365501fe70c46a01e 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -330,17 +330,19 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter var gear = gearbox.Gears[(int)i]; var lossMap = CreateGearLossMap(gear, i, true, VehicleCategory.Unknown, gearbox.Type); - var shiftPolygon = gear.ShiftPolygon != null && gear.ShiftPolygon.SourceType != DataSourceType.Missing - ? ShiftPolygonReader.Create(gear.ShiftPolygon) - : shiftPolygonCalc != null - ? shiftPolygonCalc.ComputeDeclarationShiftPolygon( - gearbox.Type, (int)i, engineData?.FullLoadCurves[i + 1], gearbox.Gears, - engineData, - axlegearRatio, dynamicTyreRadius, runData.ElectricMachinesData?.FirstOrDefault()?.Item2) - : DeclarationData.Gearbox.ComputeShiftPolygon( - gearbox.Type, (int)i, engineData?.FullLoadCurves[i + 1], gearbox.Gears, - engineData, - axlegearRatio, dynamicTyreRadius, runData.ElectricMachinesData?.FirstOrDefault()?.Item2); + ShiftPolygon shiftPolygon; + if (gear.ShiftPolygon != null && gear.ShiftPolygon.SourceType != DataSourceType.Missing) { + shiftPolygon = ShiftPolygonReader.Create(gear.ShiftPolygon); + } else if (shiftPolygonCalc != null) { + shiftPolygon = shiftPolygonCalc.ComputeDeclarationShiftPolygon(gearbox.Type, (int)i, + engineData?.FullLoadCurves[i + 1], gearbox.Gears, engineData, axlegearRatio, + dynamicTyreRadius, runData.ElectricMachinesData?.FirstOrDefault()?.Item2); + } else { + shiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(gearbox.Type, (int)i, + engineData?.FullLoadCurves[i + 1], gearbox.Gears, engineData, axlegearRatio, + dynamicTyreRadius, runData.ElectricMachinesData?.FirstOrDefault()?.Item2); + } + var gearData = new GearData { ShiftPolygon = shiftPolygon, MaxSpeed = gear.MaxInputSpeed, diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index 03f230129f9401a9a2bc2374cfe6606446b9d1ff..70351e065ade3fa073dfa390017416208d0ac432 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -574,6 +574,7 @@ namespace TUGraz.VectoCore.Models.Declaration { switch (type) { case GearboxType.AMT: + case GearboxType.APTN: // TODO MQ: 2020-10-14: compute for AMT with ICE and AMT with EM differently return ComputeEfficiencyShiftPolygon(gearIdx, fullLoadCurve, gears, engine, axlegearRatio, dynamicTyreRadius); case GearboxType.MT: diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index d1e2e6beb3db1b56243f637af5ace3db557b361f..ff91652ccb5a83eac6c6a289e29ed9deb65b417f 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -555,7 +555,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl new DummyGearboxInfo(container); new ATClutchInfo(container); break; - case PowertrainPosition.BatteryElectricE2: + case PowertrainPosition.BatteryElectricE2 when data.GearboxData.Type != GearboxType.APTN: var strategy = new PEVAMTShiftStrategy(container); em = GetElectricMachine(PowertrainPosition.BatteryElectricE2, data.ElectricMachinesData, container, es, ctl); @@ -564,6 +564,17 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl .AddComponent(em); new ATClutchInfo(container); break; + + case PowertrainPosition.BatteryElectricE2 when data.GearboxData.Type == GearboxType.APTN: + var strategyAPTN = new APTNShiftStrategy(container); + em = GetElectricMachine(PowertrainPosition.BatteryElectricE2, data.ElectricMachinesData, + container, es, ctl); + powertrain.AddComponent(new AxleGear(container, data.AxleGearData)) + .AddComponent(new APTNGearbox(container, strategyAPTN)) + .AddComponent(em); + new ATClutchInfo(container); + break; + default: throw new ArgumentOutOfRangeException(nameof(pos), pos, null); } @@ -993,6 +1004,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl case GearboxType.ATSerial: new ATClutchInfo(container); return new ATGearbox(container, strategy); + case GearboxType.APTN: + return new APTNGearbox(container, strategy); default: throw new ArgumentOutOfRangeException("Unknown Gearbox Type", container.RunData.GearboxData.Type.ToString()); } @@ -1026,9 +1039,21 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl runData.ShiftStrategy = ATShiftStrategyOptimized.Name; return new ATShiftStrategyOptimized(container); //return new ATShiftStrategy(runData, container); + case GearboxType.APTN: + switch (runData.JobType) { + case VectoSimulationJobType.ParallelHybridVehicle: + case VectoSimulationJobType.SerialHybridVehicle: + case VectoSimulationJobType.BatteryElectricVehicle: + runData.ShiftStrategy = APTNShiftStrategy.Name; + return new APTNShiftStrategy(container); + case VectoSimulationJobType.ConventionalVehicle when container.IsTestPowertrain: + return null; + default: + throw new ArgumentException("APT-N Gearbox is only applicable on hybrids and battery electric vehicles."); + } default: throw new ArgumentOutOfRangeException("GearboxType", - $"Unknown Gearbox Type {runData.GearboxData.Type.ToString()}"); + $"Unknown Gearbox Type {runData.GearboxData.Type}"); } } @@ -1098,9 +1123,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl #region Implementation of IEngineControl - public bool CombustionEngineOn - { - get { return false; } set { } } + public bool CombustionEngineOn { get; set; } #endregion } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs new file mode 100644 index 0000000000000000000000000000000000000000..bcded50386b16b534646e01f50173cf6cf3c6a06 --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs @@ -0,0 +1,86 @@ +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + /// <summary> + /// Gearbox for Automatic Power Transmission - No Torque Converter. + /// </summary> + public class APTNGearbox : Gearbox + { + public APTNGearbox(IVehicleContainer container, IShiftStrategy strategy) : base(container, strategy) + { + ModelData.TractionInterruption = 0.SI<Second>(); + } + + public override IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) + { + var absTime = 0.SI<Second>(); + var dt = Constants.SimulationSettings.TargetTimeInterval; + + EngageTime = -double.MaxValue.SI<Second>(); + + if (_strategy != null && (Disengaged || DisengageGearbox)) { + Gear = _strategy.InitGear(absTime, dt, outTorque, outAngularVelocity); + } + + var inAngularVelocity = outAngularVelocity * ModelData.Gears[Gear.Gear].Ratio; + var gearboxTorqueLoss = ModelData.Gears[Gear.Gear].LossMap.GetTorqueLoss(outAngularVelocity, outTorque); + CurrentState.TorqueLossResult = gearboxTorqueLoss; + + var inTorque = outTorque / ModelData.Gears[Gear.Gear].Ratio + + gearboxTorqueLoss.Value; + + PreviousState.SetState(inTorque, inAngularVelocity, outTorque, outAngularVelocity); + PreviousState.InertiaTorqueLossOut = 0.SI<NewtonMeter>(); + PreviousState.Gear = Gear; + Disengaged = false; + + var response = NextComponent.Initialize(inTorque, inAngularVelocity); + + return response; + } + + public override IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false) + { + var response = base.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); + if (response is ResponseGearShift) { + response = base.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); + } + return response; + } + + protected internal override ResponseDryRun Initialize(Second absTime, GearshiftPosition gear, + NewtonMeter outTorque, PerSecond outAngularVelocity) + { + var oldGear = Gear; + Gear = gear; + var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear.Gear].Ratio; + var torqueLossResult = ModelData.Gears[gear.Gear].LossMap.GetTorqueLoss(outAngularVelocity, outTorque); + CurrentState.TorqueLossResult = torqueLossResult; + var inTorque = outTorque / ModelData.Gears[gear.Gear].Ratio + torqueLossResult.Value; + + if (!inAngularVelocity.IsEqual(0)) { + var alpha = ModelData.Inertia.IsEqual(0) ? 0.SI<PerSquareSecond>() : outTorque / ModelData.Inertia; + var inertiaPowerLoss = Formulas.InertiaPower(inAngularVelocity, alpha, ModelData.Inertia, Constants.SimulationSettings.TargetTimeInterval); + inTorque += inertiaPowerLoss / inAngularVelocity; + } + + var response = NextComponent.Request(absTime, Constants.SimulationSettings.TargetTimeInterval, inTorque, inAngularVelocity, true); + + var eMotor = DataBus.ElectricMotorInfo(DataBus.PowertrainInfo.ElectricMotorPositions[0]); + var fullLoad = -eMotor.MaxPowerDrive(DataBus.BatteryInfo.InternalVoltage, inAngularVelocity); + + Gear = oldGear; + return new ResponseDryRun(this, response) { + ElectricMotor = { PowerRequest = response.ElectricMotor.PowerRequest }, + Gearbox = { PowerRequest = outTorque * outAngularVelocity }, + DeltaFullLoad = response.ElectricMotor.PowerRequest - fullLoad + }; + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs new file mode 100644 index 0000000000000000000000000000000000000000..948787726f44537174bc1c327010d5fd63fd1308 --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNShiftStrategy.cs @@ -0,0 +1,28 @@ +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class APTNShiftStrategy : PEVAMTShiftStrategy + { + public APTNShiftStrategy(IVehicleContainer dataBus) : base(dataBus) { } + + public new static string Name => "APT-N"; + + protected override GearshiftPosition CheckEarlyDownshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, GearshiftPosition currentGear, IResponse resp) + { + return base.CheckEarlyDownshift(absTime, dt, outTorque, outAngularVelocity, currentGear, resp); + } + + protected override GearshiftPosition CheckEarlyUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, GearshiftPosition currentGear, IResponse resp) + { + return base.CheckEarlyUpshift(absTime, dt, outTorque, outAngularVelocity, currentGear, resp); + } + + protected override GearshiftPosition DoCheckUpshift(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, GearshiftPosition currentGear, IResponse r) + { + return base.DoCheckUpshift(absTime, dt, outTorque, outAngularVelocity, inTorque, inAngularVelocity, currentGear, r); + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 84662db82143d49bd6b92da8b2fb7d679134cbf4..404d035726afcba1f8d2fe9d4f95a33a4f7141e6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -203,8 +203,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl HandlePCC(absTime, targetVelocity); } if (ADAS.EcoRoll != EcoRollType.None && - (pccState == PCCStates.OutsideSegment || pccState == PCCStates.WithinSegment) - ) { + (pccState == PCCStates.OutsideSegment || pccState == PCCStates.WithinSegment)) { HandleEcoRoll(absTime, targetVelocity); } @@ -287,8 +286,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl private void HandlePCC(Second absTime, MeterPerSecond targetVelocity) { - var dataBus = DataBus; - var vehicleSpeed = dataBus.VehicleInfo.VehicleSpeed; + var vehicleSpeed = DataBus.VehicleInfo.VehicleSpeed; UpdatePCCState(targetVelocity); @@ -319,12 +317,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl switch (ADAS.EcoRoll) { case EcoRollType.None: break; case EcoRollType.WithoutEngineStop: - dataBus.GearboxCtl.DisengageGearbox = true; + DataBus.GearboxCtl.DisengageGearbox = true; break; case EcoRollType.WithEngineStop: - dataBus.GearboxCtl.DisengageGearbox = true; - if (dataBus.EngineCtl != null) { - dataBus.EngineCtl.CombustionEngineOn = false; + DataBus.GearboxCtl.DisengageGearbox = true; + if (DataBus.EngineCtl != null) { + DataBus.EngineCtl.CombustionEngineOn = false; } break; default: throw new ArgumentOutOfRangeException(); @@ -334,12 +332,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl case PCCStates.OutsideSegment: case PCCStates.WithinSegment: case PCCStates.PCCinterrupt: - if (dataBus.GearboxCtl != null) { - dataBus.GearboxCtl.DisengageGearbox = false; + if (DataBus.GearboxCtl != null) { + DataBus.GearboxCtl.DisengageGearbox = false; } - if (dataBus.EngineCtl != null) { - dataBus.EngineCtl.CombustionEngineOn = true; + if (DataBus.EngineCtl != null) { + DataBus.EngineCtl.CombustionEngineOn = true; } break; default: throw new ArgumentOutOfRangeException(); @@ -962,7 +960,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl // unfortunately, this causes issues for P1 hybrid configurations with AT gearbox in torque converter gear. If the EM propells, the torque // converter cannot find an operating point close to the drag point. therefore, do not announce the different action except for driving off from // standstill. - var overrideAction = DataBus.GearboxInfo.GearboxType.AutomaticTransmission() + var overrideAction = DataBus.GearboxInfo.GearboxType.AutomaticTransmission() && (DataBus.GearboxInfo.Gear.TorqueConverterLocked.HasValue && !DataBus.GearboxInfo.Gear.TorqueConverterLocked.Value) && (DataBus.ElectricMotorInfo(PowertrainPosition.HybridP1) == null || DataBus.VehicleInfo.VehicleStopped) ? DrivingAction.Accelerate diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index 722129bad53130f0d8d96b20cfae700054e4f59b..ccc0f78eca2c4636fdce3fbd1d219ee60e91a038 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -828,7 +828,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (DataBus.HybridControllerInfo != null) { DrivingAction = DrivingAction.Brake; } - if (DataBus.GearboxInfo.GearboxType.AutomaticTransmission()) { + if (DataBus.GearboxInfo.GearboxType.AutomaticTransmission() || DataBus.GearboxInfo.GearboxType == GearboxType.APTN) { operatingPoint = SearchBrakingPower(absTime, operatingPoint.SimulationDistance, gradient, operatingPoint.Acceleration, response); DriverAcceleration = operatingPoint.Acceleration; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 322b3a16d938b62c8ddb8c24d9d8e2a0002b7dfc..c2061789a9671ff8bf9be5760acd1fb7d1e9cca5 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -30,7 +30,6 @@ */ using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; @@ -289,10 +288,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl CurrentState.DrivingBehavior = DataBus.DriverInfo.DriverBehavior; } - return GearEngaged(absTime) - ? RequestGearEngaged(absTime, dt, outTorque, outAngularVelocity, inTorque, inTorqueLossResult, - inertiaTorqueLossOut, dryRun) - : RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, inTorque, dryRun); + if (GearEngaged(absTime)) { + return RequestGearEngaged(absTime, dt, outTorque, outAngularVelocity, inTorque, inTorqueLossResult, inertiaTorqueLossOut, dryRun); + } else { + return RequestGearDisengaged(absTime, dt, outTorque, outAngularVelocity, inTorque, dryRun); + } } /// <summary> @@ -564,46 +564,4 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public override Second LastShift => EngageTime; } - - public class PEVGearbox : Gearbox - { - public PEVGearbox(IVehicleContainer container, IShiftStrategy strategy) : base(container, strategy) { } - - protected internal override ResponseDryRun Initialize(Second absTime, GearshiftPosition gear, NewtonMeter outTorque, PerSecond outAngularVelocity) - { - var oldGear = Gear; - Gear = gear; - var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear.Gear].Ratio; - var torqueLossResult = ModelData.Gears[gear.Gear].LossMap.GetTorqueLoss(outAngularVelocity, outTorque); - CurrentState.TorqueLossResult = torqueLossResult; - var inTorque = outTorque / ModelData.Gears[gear.Gear].Ratio + torqueLossResult.Value; - - if (!inAngularVelocity.IsEqual(0)) { - var alpha = ModelData.Inertia.IsEqual(0) - ? 0.SI<PerSquareSecond>() - : outTorque / ModelData.Inertia; - - var inertiaPowerLoss = Formulas.InertiaPower(inAngularVelocity, alpha, ModelData.Inertia, - Constants.SimulationSettings.TargetTimeInterval); - inTorque += inertiaPowerLoss / inAngularVelocity; - } - - var response = - NextComponent.Request(absTime, Constants.SimulationSettings.TargetTimeInterval, inTorque, - inAngularVelocity, true); //NextComponent.Initialize(inTorque, inAngularVelocity); - - var fullLoad = -DataBus.ElectricMotorInfo(PowertrainPosition.BatteryElectricE2).MaxPowerDrive(DataBus.BatteryInfo.InternalVoltage, inAngularVelocity); - - Gear = oldGear; - return new ResponseDryRun(this, response) { - ElectricMotor = { - PowerRequest = response.ElectricMotor.PowerRequest - }, - Gearbox = { - PowerRequest = outTorque * outAngularVelocity, - }, - DeltaFullLoad = response.ElectricMotor.PowerRequest - fullLoad - }; - } - } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs index cae43d49e09307c47c46bc8249936f19908f7488..6443025dec6d4bc990ff597d0e9c7dfee8aa770f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs @@ -194,7 +194,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return retVal; } - private bool DoCheckShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, GearshiftPosition gear, Second lastShiftTime, IResponse response) + private bool DoCheckShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, + PerSecond outAngularVelocity, NewtonMeter inTorque, PerSecond inAngularVelocity, + GearshiftPosition gear, Second lastShiftTime, IResponse response) { // no shift when vehicle stands if (DataBus.VehicleInfo.VehicleStopped) { @@ -437,7 +439,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return nextGear; } - if (response.ElectricMotor.TorqueRequestEmMap != null && response.ElectricMotor.TorqueRequestEmMap.IsEqual( + if (response.ElectricMotor.TorqueRequestEmMap != null + && response.ElectricMotor.MaxRecuperationTorqueEM != null + && response.ElectricMotor.TorqueRequestEmMap.IsEqual( response.ElectricMotor.MaxRecuperationTorqueEM, response.ElectricMotor.MaxRecuperationTorqueEM * 0.1)) { // no early downshift when close to max recuperation line @@ -776,5 +780,4 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion } - } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVGearbox.cs new file mode 100644 index 0000000000000000000000000000000000000000..84df366005d118702710010045c3b416c58598fd --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVGearbox.cs @@ -0,0 +1,51 @@ +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class PEVGearbox : Gearbox + { + public PEVGearbox(IVehicleContainer container, IShiftStrategy strategy) : base(container, strategy) { } + + protected internal override ResponseDryRun Initialize(Second absTime, GearshiftPosition gear, NewtonMeter outTorque, PerSecond outAngularVelocity) + { + var oldGear = Gear; + Gear = gear; + var inAngularVelocity = outAngularVelocity * ModelData.Gears[gear.Gear].Ratio; + var torqueLossResult = ModelData.Gears[gear.Gear].LossMap.GetTorqueLoss(outAngularVelocity, outTorque); + CurrentState.TorqueLossResult = torqueLossResult; + var inTorque = outTorque / ModelData.Gears[gear.Gear].Ratio + torqueLossResult.Value; + + if (!inAngularVelocity.IsEqual(0)) { + var alpha = ModelData.Inertia.IsEqual(0) + ? 0.SI<PerSquareSecond>() + : outTorque / ModelData.Inertia; + + var inertiaPowerLoss = Formulas.InertiaPower(inAngularVelocity, alpha, ModelData.Inertia, + Constants.SimulationSettings.TargetTimeInterval); + inTorque += inertiaPowerLoss / inAngularVelocity; + } + + var response = + NextComponent.Request(absTime, Constants.SimulationSettings.TargetTimeInterval, inTorque, + inAngularVelocity, true); //NextComponent.Initialize(inTorque, inAngularVelocity); + + var fullLoad = -DataBus.ElectricMotorInfo(PowertrainPosition.BatteryElectricE2).MaxPowerDrive(DataBus.BatteryInfo.InternalVoltage, inAngularVelocity); + + Gear = oldGear; + return new ResponseDryRun(this, response) { + ElectricMotor = { + PowerRequest = response.ElectricMotor.PowerRequest + }, + Gearbox = { + PowerRequest = outTorque * outAngularVelocity, + }, + DeltaFullLoad = response.ElectricMotor.PowerRequest - fullLoad + }; + } + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 3d572afbbfb4a2c27b60bbcd3928deae27e5d094..29e6547b26fec600561efa3ed11e7725b3b89c77 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -84,8 +84,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies if (!AllowEmergencyShift && ModelData.GearboxData.Gears[nextGear.Gear].Ratio >= ModelData.GearshiftParameters.RatioEarlyDownshiftFC) { return null; } - - var estimatedVelocityPostShift = VelocityDropData.Interpolate(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + var estimatedVelocityPostShift = !VelocityDropData.Valid ? DataBus.VehicleInfo.VehicleSpeed : VelocityDropData.Interpolate(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); if (!AllowEmergencyShift && !estimatedVelocityPostShift.IsGreater(DeclarationData.GearboxTCU.MIN_SPEED_AFTER_TRACTION_INTERRUPTION)) { return null; } @@ -227,7 +226,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } TestPowertrain.SuperCap?.Initialize(DataBus.BatteryInfo.StateOfCharge); - TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; var currentGear = PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear; @@ -996,15 +994,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies protected virtual bool AllowICEOff(Second absTime) { - //if (!ModelData.VehicleData.ADAS.EngineStopStart) { - // return false; - //} - var emPos = ModelData.ElectricMachinesData.First().Item1; - if (/*ModelData.VehicleData.ADAS.EngineStopStart &&*/ emPos == PowertrainPosition.HybridP1) { - return false; - } - return PreviousState.ICEStartTStmp == null || - (PreviousState.ICEStartTStmp + StrategyParameters.MinICEOnTime).IsSmaller(absTime); + return PreviousState.ICEStartTStmp == null + || (PreviousState.ICEStartTStmp + StrategyParameters.MinICEOnTime).IsSmaller(absTime); } protected virtual void HandleBrakeAction(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun, List<HybridResultEntry> eval) @@ -1204,22 +1195,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return; } - var iceOn = DataBus.EngineInfo.EngineOn; - // if Hybrid P1 and Engine is off, the search for braking power is not possible: - // Therefore, switch on engine (if reasonable), otherwise simply do NOT search for mechanicalAssistPower. - if (emPos == PowertrainPosition.HybridP1 && !DataBus.EngineCtl.CombustionEngineOn) { - - var gearboxOut = firstResponse.Gearbox.OutputSpeed * firstResponse.Gearbox.OutputTorque; - var elMotor = DataBus.ElectricMotorInfo(PowertrainPosition.HybridP1); - var powerToleranceEl = 0.1 * elMotor.MaxPowerDrive(DataBus.BatteryInfo.InternalVoltage, firstResponse.Engine.EngineSpeed); - if (gearboxOut - firstResponse.Engine.DragPower < powerToleranceEl) { - DataBus.EngineCtl.CombustionEngineOn = true; - iceOn = true; - } else { - return; - } - } - // full recuperation is not possible - ICE would need to propel - search max possible EM torque var emRecuperationTq = SearchAlgorithm.Search( maxRecuperationResponse.ElectricMotor.ElectricMotorPowerMech / @@ -1237,7 +1212,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies }, evaluateFunction: emTq => { var cfg = new HybridStrategyResponse { - CombustionEngineOn = iceOn, + CombustionEngineOn = DataBus.EngineInfo.EngineOn, GearboxInNeutral = false, NextGear = nextGear, MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>> { @@ -1375,8 +1350,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } var result = ResponseEmOff; - if (DataBus.DriverInfo.PCCState == PCCStates.UseCase1 || DataBus.DriverInfo.PCCState == PCCStates.UseCase2) - result.ICEOff = true; + if (DataBus.DriverInfo.PCCState.IsOneOf(PCCStates.UseCase1, PCCStates.UseCase2)) { + result.ICEOff = AllowICEOff(absTime); + result.Setting.CombustionEngineOn = !result.ICEOff; + + if (DataBus.PowertrainInfo.ElectricMotorPositions.Contains(PowertrainPosition.HybridP1)) { + // special logic for HybridP1 (VECTO-1493) + result.Setting.GearboxInNeutral = true; + result.ICEOff &= ModelData.VehicleData.ADAS.EngineStopStart; + } + } eval.Add(result); } @@ -1896,7 +1879,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies }, evaluateFunction: emTq => { var cfg = new HybridStrategyResponse { - CombustionEngineOn = nextGear.IsLockedGear()? true : false, + CombustionEngineOn = nextGear.IsLockedGear() ? true : false, GearboxInNeutral = false, MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>> { { emPos, Tuple.Create(firstResponse.ElectricMotor.AngularVelocity, emTq) } diff --git a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs index df08f06bdac90e5f2835dea3e933bd81061a76c2..e966a8e1dbbd29313aa68c53e47fe67e2f97a0ae 100644 --- a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs @@ -785,7 +785,7 @@ namespace TUGraz.VectoCore.OutputData { var data = runData.VehicleData; //if (runData.VehicleData.b) - var gbxType = runData.GearboxData?.Type ?? GearboxType.NoGeabox; + var gbxType = runData.GearboxData?.Type ?? GearboxType.NoGearbox; row[Fields.VEHICLE_MANUFACTURER] = data.Manufacturer; row[Fields.VIN_NUMBER] = data.VIN; diff --git a/VectoCore/VectoCore/Utils/Interpolate2D.cs b/VectoCore/VectoCore/Utils/Interpolate2D.cs index 996387af06320955b82a9b43d857159b17bfee6a..a4db8d96d8962c784bc93aee091bcff5e53d7e61 100644 --- a/VectoCore/VectoCore/Utils/Interpolate2D.cs +++ b/VectoCore/VectoCore/Utils/Interpolate2D.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Data; -using System.Diagnostics; using System.Linq; using TUGraz.VectoCommon.Utils; @@ -19,7 +17,6 @@ namespace TUGraz.VectoCore.Utils protected void SetData(TEntry[] entries) { - var stop = Stopwatch.StartNew(); _data = new DataTable(); var xEntries = new List<KeyValuePair<TKeyX, int>>(); var idx = 0; @@ -45,8 +42,6 @@ namespace TUGraz.VectoCore.Utils var row = entriesY.First(x => x.Key.IsEqual(GetYValue(entry))); _data.Rows[row.Value][col.Value] = GetZValue(entry); } - stop.Stop(); - //Console.WriteLine("setData: {0}", stop.ElapsedMilliseconds); } protected abstract TKeyX GetXValue(TEntry entry); diff --git a/VectoCore/VectoCore/VectoCore.csproj b/VectoCore/VectoCore/VectoCore.csproj index 3736c132f5fcd32a11f6965a264fff46301b07e3..57593497fc5a31404b16f6415f02d04c10952a7a 100644 --- a/VectoCore/VectoCore/VectoCore.csproj +++ b/VectoCore/VectoCore/VectoCore.csproj @@ -288,8 +288,11 @@ <Compile Include="InputData\FileIO\XML\XMLInputDataNinjectModule.cs" /> <Compile Include="InputData\Reader\ComponentData\BatteryInternalResistanceReader.cs" /> <Compile Include="InputData\Reader\ComponentData\BatteryMaxCurrentReader.cs" /> + <Compile Include="Models\SimulationComponent\Impl\APTNGearbox.cs" /> + <Compile Include="Models\SimulationComponent\Impl\APTNShiftStrategy.cs" /> <Compile Include="Models\SimulationComponent\Impl\BatterySystem.cs" /> <Compile Include="Models\SimulationComponent\Impl\DummyAxleGearInfo.cs" /> + <Compile Include="Models\SimulationComponent\Impl\PEVGearbox.cs" /> <Compile Include="Models\SimulationComponent\Impl\PTODriveAuxiliary.cs" /> <Compile Include="Models\SimulationComponent\Impl\RoadSweeperAuxiliary.cs" /> <Compile Include="InputData\Reader\ComponentData\ElectricMotorMapReader.cs" /> diff --git a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs index 09d1ae1d1e98ae9e3c7d6d2ff55f80e3b30054db..bf2ec9ee61f5a2a19bb34e2915afa017bdb6ef32 100644 --- a/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs +++ b/VectoCore/VectoCoreTest/Integration/Hybrid/ParallelHybridTest.cs @@ -1364,7 +1364,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid public static JobContainer CreateEngineeringRun(DrivingCycleData cycleData, string modFileName, double initialSoc, PowertrainPosition pos, double ratio, bool largeMotor = false, double pAuxEl = 0, - Kilogram payload = null, Watt maxDriveTrainPower = null, GearboxType gearboxType = GearboxType.NoGeabox) + Kilogram payload = null, Watt maxDriveTrainPower = null, GearboxType gearboxType = GearboxType.NoGearbox) { var fileWriter = new FileOutputWriter(Path.GetFileNameWithoutExtension(modFileName)); var sumData = new SummaryDataContainer(fileWriter); @@ -1387,7 +1387,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid public static VehicleContainer CreateParallelHybridPowerTrain(DrivingCycleData cycleData, string modFileName, double initialBatCharge, bool largeMotor, SummaryDataContainer sumData, double pAuxEl, - PowertrainPosition pos, double ratio, Kilogram payload = null, Watt maxDriveTrainPower = null, GearboxType gearboxType = GearboxType.NoGeabox) + PowertrainPosition pos, double ratio, Kilogram payload = null, Watt maxDriveTrainPower = null, GearboxType gearboxType = GearboxType.NoGearbox) { var gearboxData = CreateGearboxData(gearboxType); var axleGearData = CreateAxleGearData(gearboxType); @@ -1677,11 +1677,11 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid return motor; } - private static GearboxData CreateGearboxData(GearboxType gearboxType = GearboxType.NoGeabox) + private static GearboxData CreateGearboxData(GearboxType gearboxType = GearboxType.NoGearbox) { switch (gearboxType) { - case GearboxType.NoGeabox: + case GearboxType.NoGearbox: case GearboxType.AMT: return CreateAMTGearbox(); case GearboxType.ATSerial: