From 3ebefe8b66b46b29d3314ddc9b47194e94505dfa Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Wed, 2 Dec 2020 09:28:17 +0100 Subject: [PATCH] fix testcase after driver refacoring (max speed calculation) --- .../Models/SimulationComponent/DriverTest.cs | 10 +++-- VectoCore/VectoCoreTest/Utils/MockGearbox.cs | 42 ++++++++++++++++++- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs index f23aaf6d34..7d235449c6 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs @@ -51,6 +51,7 @@ using TUGraz.VectoCore.Tests.Utils; using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels; using NUnit.Framework; using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; namespace TUGraz.VectoCore.Tests.Models.SimulationComponent { @@ -105,6 +106,7 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent clutch.IdleController = engine.IdleController; var gbx = new MockGearbox(vehicleContainer) { Gear = new GearshiftPosition(1) }; + var axlegear = new MockAxlegear(vehicleContainer); var driverPort = driver.OutPort(); @@ -170,8 +172,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent AddComponent(tmp, engine); clutch.IdleController = engine.IdleController; - var gbx = new MockGearbox(vehicleContainer); - gbx.Gear = new GearshiftPosition(1); + var gbx = new MockGearbox(vehicleContainer) { Gear = new GearshiftPosition(1) }; + var axleGear = new MockAxlegear(vehicleContainer); var driverPort = driver.OutPort(); @@ -244,8 +246,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent tmp = AddComponent(tmp, clutch); AddComponent(tmp, engine); - var gbx = new MockGearbox(vehicleContainer); - gbx.Gear = new GearshiftPosition(1); + var gbx = new MockGearbox(vehicleContainer) { Gear = new GearshiftPosition(1) }; + var axleGear = new MockAxlegear(vehicleContainer); var driverPort = driver.OutPort(); diff --git a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs index f599e8d222..eedfc96df3 100644 --- a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs +++ b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs @@ -35,6 +35,7 @@ using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.Simulation.Impl; using TUGraz.VectoCore.Models.SimulationComponent; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; using TUGraz.VectoCore.Models.SimulationComponent.Impl; @@ -108,7 +109,7 @@ namespace TUGraz.VectoCore.Tests.Utils public GearData GetGearData(uint gear) { - return new GearData(); + return new GearData() { Ratio = 1.0 }; } public void Connect(ITnOutPort other) @@ -175,4 +176,43 @@ namespace TUGraz.VectoCore.Tests.Utils throw new NotImplementedException(); } } + + public class MockAxlegear : VectoSimulationComponent, IAxlegear + { + public MockAxlegear(VehicleContainer vehicleContainer) : base(vehicleContainer) + { + + } + + public ITnInPort InPort() + { + throw new NotImplementedException(); + } + + public ITnOutPort OutPort() + { + throw new NotImplementedException(); + } + + public Watt AxlegearLoss() + { + throw new NotImplementedException(); + } + + public Tuple<PerSecond, NewtonMeter> CurrentAxleDemand { get; } + public double Ratio + { + get { return 1; } + } + + protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) + { + + } + + protected override void DoCommitSimulationStep(Second time, Second simulationInterval) + { + + } + } } \ No newline at end of file -- GitLab