From 03f461b6b1625a28961fad3ba5f69bf0c1784cc5 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Mon, 22 Feb 2016 18:16:50 +0100 Subject: [PATCH] pwheel cycle with cyclegearbox --- .../Models/Simulation/Impl/PowertrainBuilder.cs | 12 +++++------- .../Impl/PowertrainDrivingCycle.cs | 12 +++--------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index dad090e4bb..9beee35306 100644 --- a/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -18,6 +18,7 @@ using System; using System.Diagnostics; +using System.Linq; using TUGraz.VectoCore.Exceptions; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Simulation.Data; @@ -79,10 +80,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl { var container = new VehicleContainer(_modData, _sumWriter, ExecutionMode.Engineering); - data.GearboxData.Type = GearboxType.DrivingCycle; - var gearbox = GetGearbox(container, data.GearboxData); + var gearbox = new CycleGearbox(container, data.GearboxData); - var cycle = new PWheelCycle(container, data.Cycle, data.AxleGearData.AxleGear.Ratio, (Gearbox)gearbox); + var cycle = new PWheelCycle(container, data.Cycle, data.AxleGearData.AxleGear.Ratio, + gearbox.ModelData.Gears.ToDictionary(g => g.Key, g => g.Value.Ratio)); var tmp = AddComponent(cycle, new AxleGear(container, data.AxleGearData)); @@ -185,7 +186,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl new Wheels(container, data.VehicleData.DynamicTyreRadius, data.VehicleData.WheelsInertia)); var brakes = AddComponent(wheels, new Brakes(container)); var tmp = AddComponent(brakes, new AxleGear(container, data.AxleGearData)); - + var gearbox = new CycleGearbox(container, data.GearboxData); switch (data.Retarder.Type) { @@ -325,9 +326,6 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl case GearboxType.Custom: strategy = new CustomShiftStrategy(data, container); break; - case GearboxType.DrivingCycle: - strategy = new PWheelShiftStrategy(data, container); - break; default: throw new VectoSimulationException("Unknown Gearbox Type: {0}", data.Type); } diff --git a/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index 6e0518c18b..586795bc95 100644 --- a/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -189,23 +189,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// </summary> public class PWheelCycle : PowertrainDrivingCycle, IDriverInfo, IClutchInfo { - public Gearbox Gearbox { get; set; } - /// <summary> /// Initializes a new instance of the <see cref="PWheelCycle"/> class. /// </summary> /// <param name="container">The container.</param> /// <param name="cycle">The cycle.</param> /// <param name="axleRatio">The axle ratio.</param> - /// <param name="gearbox"></param> - public PWheelCycle(IVehicleContainer container, DrivingCycleData cycle, double axleRatio, Gearbox gearbox) + public PWheelCycle(IVehicleContainer container, DrivingCycleData cycle, double axleRatio, + Dictionary<uint, double> ratios) : base(container, cycle) { - Gearbox = gearbox; - foreach (var entry in Data.Entries) { entry.AngularVelocity = entry.AngularVelocity / - (axleRatio * (entry.Gear == 0 ? 1 : Gearbox.ModelData.Gears[entry.Gear].Ratio)); + (axleRatio * (entry.Gear == 0 ? 1 : ratios[entry.Gear])); entry.Torque = entry.PWheel / entry.AngularVelocity; } } @@ -216,8 +212,6 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return new ResponseCycleFinished { Source = this }; } - Gearbox.Gear = LeftSample.Current.Gear; - Gearbox.Disengaged = LeftSample.Current.Gear == 0; return base.Request(absTime, dt); } -- GitLab